@inkbar/core 0.2.0 → 0.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.
@@ -1,1183 +0,0 @@
1
- import { z } from "zod";
2
- import * as pdfjs from "pdfjs-dist";
3
- //#region src/model/geometry.d.ts
4
- /**
5
- * All geometry in this module is PDF default user space: points, origin at the
6
- * lower-left of the page, before /Rotate. Pixel conversions live in dom/transform.ts.
7
- */
8
- interface Point {
9
- x: number;
10
- y: number;
11
- }
12
- /** Axis-aligned box. `x`,`y` is the lower-left corner. */
13
- interface Rect {
14
- x: number;
15
- y: number;
16
- width: number;
17
- height: number;
18
- }
19
- /** Four corners in PDF.js's normalised QuadPoints order: upper-left, upper-right, lower-left, lower-right. */
20
- interface Quad {
21
- p1: Point;
22
- p2: Point;
23
- p3: Point;
24
- p4: Point;
25
- }
26
- /** PDF transformation matrix [a b c d e f]: x' = a·x + c·y + e, y' = b·x + d·y + f. */
27
- type Matrix = readonly [number, number, number, number, number, number];
28
- declare function approxEqual(a: number, b: number, eps?: number): boolean;
29
- declare function rectFromPoints(a: Point, b: Point): Rect;
30
- declare function rectFromQuad(q: Quad): Rect;
31
- declare function quadFromRect(r: Rect): Quad;
32
- declare function unionRects(rects: readonly Rect[]): Rect;
33
- declare function rectsIntersect(a: Rect, b: Rect): boolean;
34
- declare function rectContainsPoint(r: Rect, p: Point): boolean;
35
- declare function translateRect(r: Rect, dx: number, dy: number): Rect;
36
- declare function translateQuad(q: Quad, dx: number, dy: number): Quad;
37
- declare function applyMatrix(m: Matrix, p: Point): Point;
38
- declare function invertMatrix(m: Matrix): Matrix;
39
- /** Returns the matrix that applies `a` first, then `b`. */
40
- declare function multiplyMatrix(a: Matrix, b: Matrix): Matrix;
41
- declare function pointsFromFlat(flat: ArrayLike<number>): Point[];
42
- /** Eight numbers per quad, in PDF.js's normalised order. Trailing partial quads are dropped. */
43
- declare function quadsFromFlat(flat: ArrayLike<number>): Quad[];
44
- //#endregion
45
- //#region src/pdfjs/types.d.ts
46
- type PdfjsModule = typeof pdfjs;
47
- type PdfjsDocument = pdfjs.PDFDocumentProxy;
48
- type PdfjsPage = pdfjs.PDFPageProxy;
49
- /** The shape of one entry from `PDFPageProxy.getAnnotations()`, limited to the fields Inkbar reads. */
50
- interface PdfjsAnnotationData {
51
- id: string;
52
- subtype: string;
53
- annotationType: number;
54
- rect: [number, number, number, number];
55
- quadPoints?: Float32Array | number[] | null;
56
- color?: Uint8ClampedArray | null;
57
- interiorColor?: Uint8ClampedArray | null;
58
- opacity?: number;
59
- contentsObj?: {
60
- str: string;
61
- dir: string;
62
- };
63
- titleObj?: {
64
- str: string;
65
- dir: string;
66
- };
67
- inReplyTo?: string;
68
- replyType?: string;
69
- creationDate?: string | null;
70
- modificationDate?: string | null;
71
- name?: string;
72
- borderStyle?: {
73
- width: number;
74
- } | null;
75
- lineCoordinates?: [number, number, number, number];
76
- vertices?: Float32Array | number[];
77
- inkLists?: Array<Float32Array | number[]>;
78
- lineEndings?: string[];
79
- /** Text under a markup annotation, not a redaction's overlay text. */
80
- overlaidText?: string;
81
- defaultAppearanceData?: {
82
- fontSize: number;
83
- fontName?: string;
84
- fontColor?: Uint8ClampedArray | number[] | {
85
- [index: number]: number;
86
- };
87
- };
88
- hasAppearance?: boolean;
89
- hidden?: boolean;
90
- noView?: boolean;
91
- }
92
- interface PdfAssets {
93
- /** URL (or file path in Node) of `pdf.worker(.min).mjs`. */
94
- worker: string;
95
- /** Directory URL ending in `/` containing the packed CMaps. */
96
- cMaps: string;
97
- /** Directory URL ending in `/` containing the standard 14 fonts. */
98
- standardFonts: string;
99
- /** Directory URL ending in `/` containing the image-decoder wasm files. */
100
- wasm: string;
101
- /** Directory URL ending in `/` containing ICC profiles. Optional. */
102
- icc?: string;
103
- }
104
- //#endregion
105
- //#region src/model/pages.d.ts
106
- type PageRotation = 0 | 90 | 180 | 270;
107
- interface PageInfo {
108
- index: number;
109
- /** CropBox ∩ MediaBox in user space before /Rotate, as PDF.js reports `page.view`. */
110
- box: Rect;
111
- /** The page's own /Rotate. View rotation applied by the viewer is separate. */
112
- rotate: PageRotation;
113
- userUnit: number;
114
- /** Unrotated box width in points. */
115
- width: number;
116
- /** Unrotated box height in points. */
117
- height: number;
118
- }
119
- //#endregion
120
- //#region src/model/readable.d.ts
121
- interface Readable<T> {
122
- get(): T;
123
- subscribe(fn: (value: T) => void): () => void;
124
- }
125
- interface Writable<T> extends Readable<T> {
126
- set(this: void, value: T): void;
127
- /** Safe to call detached (`const { update } = store`). */
128
- update(this: void, fn: (value: T) => T): void;
129
- }
130
- declare function writable<T>(initial: T): Writable<T>;
131
- /**
132
- * A readable computed from `source`. It subscribes to the source only while it has
133
- * subscribers of its own, so an unobserved derived value holds no reference to the source.
134
- */
135
- declare function derived<T, U>(source: Readable<T>, fn: (value: T) => U): Readable<U>;
136
- declare function readonly<T>(w: Writable<T>): Readable<T>;
137
- //#endregion
138
- //#region src/model/annotations/types.d.ts
139
- declare const ANNOTATION_FORMAT = "inkbar/annotations";
140
- declare const ANNOTATION_VERSION = 1;
141
- declare const PointSchema: z.ZodObject<{
142
- x: z.ZodNumber;
143
- y: z.ZodNumber;
144
- }, z.core.$strip>;
145
- declare const RectSchema: z.ZodObject<{
146
- x: z.ZodNumber;
147
- y: z.ZodNumber;
148
- width: z.ZodNumber;
149
- height: z.ZodNumber;
150
- }, z.core.$strip>;
151
- declare const QuadSchema: z.ZodObject<{
152
- p1: z.ZodObject<{
153
- x: z.ZodNumber;
154
- y: z.ZodNumber;
155
- }, z.core.$strip>;
156
- p2: z.ZodObject<{
157
- x: z.ZodNumber;
158
- y: z.ZodNumber;
159
- }, z.core.$strip>;
160
- p3: z.ZodObject<{
161
- x: z.ZodNumber;
162
- y: z.ZodNumber;
163
- }, z.core.$strip>;
164
- p4: z.ZodObject<{
165
- x: z.ZodNumber;
166
- y: z.ZodNumber;
167
- }, z.core.$strip>;
168
- }, z.core.$strip>;
169
- declare const TextMarkupSchema: z.ZodObject<{
170
- id: z.ZodString;
171
- page: z.ZodNumber;
172
- rect: z.ZodObject<{
173
- x: z.ZodNumber;
174
- y: z.ZodNumber;
175
- width: z.ZodNumber;
176
- height: z.ZodNumber;
177
- }, z.core.$strip>;
178
- color: z.ZodString;
179
- opacity: z.ZodNumber;
180
- author: z.ZodOptional<z.ZodString>;
181
- contents: z.ZodOptional<z.ZodString>;
182
- inReplyTo: z.ZodOptional<z.ZodString>;
183
- createdAt: z.ZodString;
184
- modifiedAt: z.ZodString;
185
- source: z.ZodEnum<{
186
- session: "session";
187
- pdf: "pdf";
188
- }>;
189
- locked: z.ZodOptional<z.ZodBoolean>;
190
- custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
191
- type: z.ZodEnum<{
192
- highlight: "highlight";
193
- underline: "underline";
194
- strikeout: "strikeout";
195
- squiggly: "squiggly";
196
- }>;
197
- quads: z.ZodArray<z.ZodObject<{
198
- p1: z.ZodObject<{
199
- x: z.ZodNumber;
200
- y: z.ZodNumber;
201
- }, z.core.$strip>;
202
- p2: z.ZodObject<{
203
- x: z.ZodNumber;
204
- y: z.ZodNumber;
205
- }, z.core.$strip>;
206
- p3: z.ZodObject<{
207
- x: z.ZodNumber;
208
- y: z.ZodNumber;
209
- }, z.core.$strip>;
210
- p4: z.ZodObject<{
211
- x: z.ZodNumber;
212
- y: z.ZodNumber;
213
- }, z.core.$strip>;
214
- }, z.core.$strip>>;
215
- }, z.core.$strip>;
216
- declare const NoteSchema: z.ZodObject<{
217
- id: z.ZodString;
218
- page: z.ZodNumber;
219
- rect: z.ZodObject<{
220
- x: z.ZodNumber;
221
- y: z.ZodNumber;
222
- width: z.ZodNumber;
223
- height: z.ZodNumber;
224
- }, z.core.$strip>;
225
- color: z.ZodString;
226
- opacity: z.ZodNumber;
227
- author: z.ZodOptional<z.ZodString>;
228
- contents: z.ZodOptional<z.ZodString>;
229
- inReplyTo: z.ZodOptional<z.ZodString>;
230
- createdAt: z.ZodString;
231
- modifiedAt: z.ZodString;
232
- source: z.ZodEnum<{
233
- session: "session";
234
- pdf: "pdf";
235
- }>;
236
- locked: z.ZodOptional<z.ZodBoolean>;
237
- custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
238
- type: z.ZodLiteral<"note">;
239
- icon: z.ZodDefault<z.ZodEnum<{
240
- note: "note";
241
- comment: "comment";
242
- help: "help";
243
- insert: "insert";
244
- key: "key";
245
- paragraph: "paragraph";
246
- }>>;
247
- }, z.core.$strip>;
248
- declare const FreeTextSchema: z.ZodObject<{
249
- id: z.ZodString;
250
- page: z.ZodNumber;
251
- rect: z.ZodObject<{
252
- x: z.ZodNumber;
253
- y: z.ZodNumber;
254
- width: z.ZodNumber;
255
- height: z.ZodNumber;
256
- }, z.core.$strip>;
257
- color: z.ZodString;
258
- opacity: z.ZodNumber;
259
- author: z.ZodOptional<z.ZodString>;
260
- contents: z.ZodOptional<z.ZodString>;
261
- inReplyTo: z.ZodOptional<z.ZodString>;
262
- createdAt: z.ZodString;
263
- modifiedAt: z.ZodString;
264
- source: z.ZodEnum<{
265
- session: "session";
266
- pdf: "pdf";
267
- }>;
268
- locked: z.ZodOptional<z.ZodBoolean>;
269
- custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
270
- type: z.ZodLiteral<"freeText">;
271
- text: z.ZodString;
272
- fontSize: z.ZodDefault<z.ZodNumber>;
273
- fontFamily: z.ZodDefault<z.ZodString>;
274
- align: z.ZodDefault<z.ZodEnum<{
275
- left: "left";
276
- center: "center";
277
- right: "right";
278
- }>>;
279
- callout: z.ZodOptional<z.ZodArray<z.ZodObject<{
280
- x: z.ZodNumber;
281
- y: z.ZodNumber;
282
- }, z.core.$strip>>>;
283
- }, z.core.$strip>;
284
- declare const ShapeSchema: z.ZodObject<{
285
- id: z.ZodString;
286
- page: z.ZodNumber;
287
- rect: z.ZodObject<{
288
- x: z.ZodNumber;
289
- y: z.ZodNumber;
290
- width: z.ZodNumber;
291
- height: z.ZodNumber;
292
- }, z.core.$strip>;
293
- color: z.ZodString;
294
- opacity: z.ZodNumber;
295
- author: z.ZodOptional<z.ZodString>;
296
- contents: z.ZodOptional<z.ZodString>;
297
- inReplyTo: z.ZodOptional<z.ZodString>;
298
- createdAt: z.ZodString;
299
- modifiedAt: z.ZodString;
300
- source: z.ZodEnum<{
301
- session: "session";
302
- pdf: "pdf";
303
- }>;
304
- locked: z.ZodOptional<z.ZodBoolean>;
305
- custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
306
- type: z.ZodEnum<{
307
- square: "square";
308
- circle: "circle";
309
- }>;
310
- strokeWidth: z.ZodDefault<z.ZodNumber>;
311
- fill: z.ZodOptional<z.ZodString>;
312
- }, z.core.$strip>;
313
- declare const LineEndingSchema: z.ZodEnum<{
314
- square: "square";
315
- circle: "circle";
316
- none: "none";
317
- openArrow: "openArrow";
318
- closedArrow: "closedArrow";
319
- diamond: "diamond";
320
- butt: "butt";
321
- slash: "slash";
322
- }>;
323
- declare const LineSchema: z.ZodObject<{
324
- id: z.ZodString;
325
- page: z.ZodNumber;
326
- rect: z.ZodObject<{
327
- x: z.ZodNumber;
328
- y: z.ZodNumber;
329
- width: z.ZodNumber;
330
- height: z.ZodNumber;
331
- }, z.core.$strip>;
332
- color: z.ZodString;
333
- opacity: z.ZodNumber;
334
- author: z.ZodOptional<z.ZodString>;
335
- contents: z.ZodOptional<z.ZodString>;
336
- inReplyTo: z.ZodOptional<z.ZodString>;
337
- createdAt: z.ZodString;
338
- modifiedAt: z.ZodString;
339
- source: z.ZodEnum<{
340
- session: "session";
341
- pdf: "pdf";
342
- }>;
343
- locked: z.ZodOptional<z.ZodBoolean>;
344
- custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
345
- type: z.ZodLiteral<"line">;
346
- start: z.ZodObject<{
347
- x: z.ZodNumber;
348
- y: z.ZodNumber;
349
- }, z.core.$strip>;
350
- end: z.ZodObject<{
351
- x: z.ZodNumber;
352
- y: z.ZodNumber;
353
- }, z.core.$strip>;
354
- strokeWidth: z.ZodDefault<z.ZodNumber>;
355
- endings: z.ZodOptional<z.ZodTuple<[z.ZodEnum<{
356
- square: "square";
357
- circle: "circle";
358
- none: "none";
359
- openArrow: "openArrow";
360
- closedArrow: "closedArrow";
361
- diamond: "diamond";
362
- butt: "butt";
363
- slash: "slash";
364
- }>, z.ZodEnum<{
365
- square: "square";
366
- circle: "circle";
367
- none: "none";
368
- openArrow: "openArrow";
369
- closedArrow: "closedArrow";
370
- diamond: "diamond";
371
- butt: "butt";
372
- slash: "slash";
373
- }>], null>>;
374
- }, z.core.$strip>;
375
- declare const PolySchema: z.ZodObject<{
376
- id: z.ZodString;
377
- page: z.ZodNumber;
378
- rect: z.ZodObject<{
379
- x: z.ZodNumber;
380
- y: z.ZodNumber;
381
- width: z.ZodNumber;
382
- height: z.ZodNumber;
383
- }, z.core.$strip>;
384
- color: z.ZodString;
385
- opacity: z.ZodNumber;
386
- author: z.ZodOptional<z.ZodString>;
387
- contents: z.ZodOptional<z.ZodString>;
388
- inReplyTo: z.ZodOptional<z.ZodString>;
389
- createdAt: z.ZodString;
390
- modifiedAt: z.ZodString;
391
- source: z.ZodEnum<{
392
- session: "session";
393
- pdf: "pdf";
394
- }>;
395
- locked: z.ZodOptional<z.ZodBoolean>;
396
- custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
397
- type: z.ZodEnum<{
398
- polyline: "polyline";
399
- polygon: "polygon";
400
- }>;
401
- vertices: z.ZodArray<z.ZodObject<{
402
- x: z.ZodNumber;
403
- y: z.ZodNumber;
404
- }, z.core.$strip>>;
405
- strokeWidth: z.ZodDefault<z.ZodNumber>;
406
- fill: z.ZodOptional<z.ZodString>;
407
- }, z.core.$strip>;
408
- declare const InkSchema: z.ZodObject<{
409
- id: z.ZodString;
410
- page: z.ZodNumber;
411
- rect: z.ZodObject<{
412
- x: z.ZodNumber;
413
- y: z.ZodNumber;
414
- width: z.ZodNumber;
415
- height: z.ZodNumber;
416
- }, z.core.$strip>;
417
- color: z.ZodString;
418
- opacity: z.ZodNumber;
419
- author: z.ZodOptional<z.ZodString>;
420
- contents: z.ZodOptional<z.ZodString>;
421
- inReplyTo: z.ZodOptional<z.ZodString>;
422
- createdAt: z.ZodString;
423
- modifiedAt: z.ZodString;
424
- source: z.ZodEnum<{
425
- session: "session";
426
- pdf: "pdf";
427
- }>;
428
- locked: z.ZodOptional<z.ZodBoolean>;
429
- custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
430
- type: z.ZodLiteral<"ink">;
431
- paths: z.ZodArray<z.ZodArray<z.ZodObject<{
432
- x: z.ZodNumber;
433
- y: z.ZodNumber;
434
- }, z.core.$strip>>>;
435
- strokeWidth: z.ZodDefault<z.ZodNumber>;
436
- }, z.core.$strip>;
437
- declare const SuggestionSchema: z.ZodObject<{
438
- jobId: z.ZodOptional<z.ZodString>;
439
- confidence: z.ZodNumber;
440
- reason: z.ZodOptional<z.ZodString>;
441
- explanation: z.ZodOptional<z.ZodString>;
442
- recommendation: z.ZodOptional<z.ZodEnum<{
443
- redact: "redact";
444
- review: "review";
445
- keep: "keep";
446
- }>>;
447
- }, z.core.$strip>;
448
- declare const RedactSchema: z.ZodObject<{
449
- id: z.ZodString;
450
- page: z.ZodNumber;
451
- rect: z.ZodObject<{
452
- x: z.ZodNumber;
453
- y: z.ZodNumber;
454
- width: z.ZodNumber;
455
- height: z.ZodNumber;
456
- }, z.core.$strip>;
457
- color: z.ZodString;
458
- opacity: z.ZodNumber;
459
- author: z.ZodOptional<z.ZodString>;
460
- contents: z.ZodOptional<z.ZodString>;
461
- inReplyTo: z.ZodOptional<z.ZodString>;
462
- createdAt: z.ZodString;
463
- modifiedAt: z.ZodString;
464
- source: z.ZodEnum<{
465
- session: "session";
466
- pdf: "pdf";
467
- }>;
468
- locked: z.ZodOptional<z.ZodBoolean>;
469
- custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
470
- type: z.ZodLiteral<"redact">;
471
- quads: z.ZodOptional<z.ZodArray<z.ZodObject<{
472
- p1: z.ZodObject<{
473
- x: z.ZodNumber;
474
- y: z.ZodNumber;
475
- }, z.core.$strip>;
476
- p2: z.ZodObject<{
477
- x: z.ZodNumber;
478
- y: z.ZodNumber;
479
- }, z.core.$strip>;
480
- p3: z.ZodObject<{
481
- x: z.ZodNumber;
482
- y: z.ZodNumber;
483
- }, z.core.$strip>;
484
- p4: z.ZodObject<{
485
- x: z.ZodNumber;
486
- y: z.ZodNumber;
487
- }, z.core.$strip>;
488
- }, z.core.$strip>>>;
489
- origin: z.ZodDefault<z.ZodEnum<{
490
- user: "user";
491
- suggested: "suggested";
492
- }>>;
493
- suggestion: z.ZodOptional<z.ZodObject<{
494
- jobId: z.ZodOptional<z.ZodString>;
495
- confidence: z.ZodNumber;
496
- reason: z.ZodOptional<z.ZodString>;
497
- explanation: z.ZodOptional<z.ZodString>;
498
- recommendation: z.ZodOptional<z.ZodEnum<{
499
- redact: "redact";
500
- review: "review";
501
- keep: "keep";
502
- }>>;
503
- }, z.core.$strip>>;
504
- overlayText: z.ZodOptional<z.ZodString>;
505
- fill: z.ZodString;
506
- }, z.core.$strip>;
507
- declare const AnnotationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
508
- id: z.ZodString;
509
- page: z.ZodNumber;
510
- rect: z.ZodObject<{
511
- x: z.ZodNumber;
512
- y: z.ZodNumber;
513
- width: z.ZodNumber;
514
- height: z.ZodNumber;
515
- }, z.core.$strip>;
516
- color: z.ZodString;
517
- opacity: z.ZodNumber;
518
- author: z.ZodOptional<z.ZodString>;
519
- contents: z.ZodOptional<z.ZodString>;
520
- inReplyTo: z.ZodOptional<z.ZodString>;
521
- createdAt: z.ZodString;
522
- modifiedAt: z.ZodString;
523
- source: z.ZodEnum<{
524
- session: "session";
525
- pdf: "pdf";
526
- }>;
527
- locked: z.ZodOptional<z.ZodBoolean>;
528
- custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
529
- type: z.ZodEnum<{
530
- highlight: "highlight";
531
- underline: "underline";
532
- strikeout: "strikeout";
533
- squiggly: "squiggly";
534
- }>;
535
- quads: z.ZodArray<z.ZodObject<{
536
- p1: z.ZodObject<{
537
- x: z.ZodNumber;
538
- y: z.ZodNumber;
539
- }, z.core.$strip>;
540
- p2: z.ZodObject<{
541
- x: z.ZodNumber;
542
- y: z.ZodNumber;
543
- }, z.core.$strip>;
544
- p3: z.ZodObject<{
545
- x: z.ZodNumber;
546
- y: z.ZodNumber;
547
- }, z.core.$strip>;
548
- p4: z.ZodObject<{
549
- x: z.ZodNumber;
550
- y: z.ZodNumber;
551
- }, z.core.$strip>;
552
- }, z.core.$strip>>;
553
- }, z.core.$strip>, z.ZodObject<{
554
- id: z.ZodString;
555
- page: z.ZodNumber;
556
- rect: z.ZodObject<{
557
- x: z.ZodNumber;
558
- y: z.ZodNumber;
559
- width: z.ZodNumber;
560
- height: z.ZodNumber;
561
- }, z.core.$strip>;
562
- color: z.ZodString;
563
- opacity: z.ZodNumber;
564
- author: z.ZodOptional<z.ZodString>;
565
- contents: z.ZodOptional<z.ZodString>;
566
- inReplyTo: z.ZodOptional<z.ZodString>;
567
- createdAt: z.ZodString;
568
- modifiedAt: z.ZodString;
569
- source: z.ZodEnum<{
570
- session: "session";
571
- pdf: "pdf";
572
- }>;
573
- locked: z.ZodOptional<z.ZodBoolean>;
574
- custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
575
- type: z.ZodLiteral<"note">;
576
- icon: z.ZodDefault<z.ZodEnum<{
577
- note: "note";
578
- comment: "comment";
579
- help: "help";
580
- insert: "insert";
581
- key: "key";
582
- paragraph: "paragraph";
583
- }>>;
584
- }, z.core.$strip>, z.ZodObject<{
585
- id: z.ZodString;
586
- page: z.ZodNumber;
587
- rect: z.ZodObject<{
588
- x: z.ZodNumber;
589
- y: z.ZodNumber;
590
- width: z.ZodNumber;
591
- height: z.ZodNumber;
592
- }, z.core.$strip>;
593
- color: z.ZodString;
594
- opacity: z.ZodNumber;
595
- author: z.ZodOptional<z.ZodString>;
596
- contents: z.ZodOptional<z.ZodString>;
597
- inReplyTo: z.ZodOptional<z.ZodString>;
598
- createdAt: z.ZodString;
599
- modifiedAt: z.ZodString;
600
- source: z.ZodEnum<{
601
- session: "session";
602
- pdf: "pdf";
603
- }>;
604
- locked: z.ZodOptional<z.ZodBoolean>;
605
- custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
606
- type: z.ZodLiteral<"freeText">;
607
- text: z.ZodString;
608
- fontSize: z.ZodDefault<z.ZodNumber>;
609
- fontFamily: z.ZodDefault<z.ZodString>;
610
- align: z.ZodDefault<z.ZodEnum<{
611
- left: "left";
612
- center: "center";
613
- right: "right";
614
- }>>;
615
- callout: z.ZodOptional<z.ZodArray<z.ZodObject<{
616
- x: z.ZodNumber;
617
- y: z.ZodNumber;
618
- }, z.core.$strip>>>;
619
- }, z.core.$strip>, z.ZodObject<{
620
- id: z.ZodString;
621
- page: z.ZodNumber;
622
- rect: z.ZodObject<{
623
- x: z.ZodNumber;
624
- y: z.ZodNumber;
625
- width: z.ZodNumber;
626
- height: z.ZodNumber;
627
- }, z.core.$strip>;
628
- color: z.ZodString;
629
- opacity: z.ZodNumber;
630
- author: z.ZodOptional<z.ZodString>;
631
- contents: z.ZodOptional<z.ZodString>;
632
- inReplyTo: z.ZodOptional<z.ZodString>;
633
- createdAt: z.ZodString;
634
- modifiedAt: z.ZodString;
635
- source: z.ZodEnum<{
636
- session: "session";
637
- pdf: "pdf";
638
- }>;
639
- locked: z.ZodOptional<z.ZodBoolean>;
640
- custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
641
- type: z.ZodEnum<{
642
- square: "square";
643
- circle: "circle";
644
- }>;
645
- strokeWidth: z.ZodDefault<z.ZodNumber>;
646
- fill: z.ZodOptional<z.ZodString>;
647
- }, z.core.$strip>, z.ZodObject<{
648
- id: z.ZodString;
649
- page: z.ZodNumber;
650
- rect: z.ZodObject<{
651
- x: z.ZodNumber;
652
- y: z.ZodNumber;
653
- width: z.ZodNumber;
654
- height: z.ZodNumber;
655
- }, z.core.$strip>;
656
- color: z.ZodString;
657
- opacity: z.ZodNumber;
658
- author: z.ZodOptional<z.ZodString>;
659
- contents: z.ZodOptional<z.ZodString>;
660
- inReplyTo: z.ZodOptional<z.ZodString>;
661
- createdAt: z.ZodString;
662
- modifiedAt: z.ZodString;
663
- source: z.ZodEnum<{
664
- session: "session";
665
- pdf: "pdf";
666
- }>;
667
- locked: z.ZodOptional<z.ZodBoolean>;
668
- custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
669
- type: z.ZodLiteral<"line">;
670
- start: z.ZodObject<{
671
- x: z.ZodNumber;
672
- y: z.ZodNumber;
673
- }, z.core.$strip>;
674
- end: z.ZodObject<{
675
- x: z.ZodNumber;
676
- y: z.ZodNumber;
677
- }, z.core.$strip>;
678
- strokeWidth: z.ZodDefault<z.ZodNumber>;
679
- endings: z.ZodOptional<z.ZodTuple<[z.ZodEnum<{
680
- square: "square";
681
- circle: "circle";
682
- none: "none";
683
- openArrow: "openArrow";
684
- closedArrow: "closedArrow";
685
- diamond: "diamond";
686
- butt: "butt";
687
- slash: "slash";
688
- }>, z.ZodEnum<{
689
- square: "square";
690
- circle: "circle";
691
- none: "none";
692
- openArrow: "openArrow";
693
- closedArrow: "closedArrow";
694
- diamond: "diamond";
695
- butt: "butt";
696
- slash: "slash";
697
- }>], null>>;
698
- }, z.core.$strip>, z.ZodObject<{
699
- id: z.ZodString;
700
- page: z.ZodNumber;
701
- rect: z.ZodObject<{
702
- x: z.ZodNumber;
703
- y: z.ZodNumber;
704
- width: z.ZodNumber;
705
- height: z.ZodNumber;
706
- }, z.core.$strip>;
707
- color: z.ZodString;
708
- opacity: z.ZodNumber;
709
- author: z.ZodOptional<z.ZodString>;
710
- contents: z.ZodOptional<z.ZodString>;
711
- inReplyTo: z.ZodOptional<z.ZodString>;
712
- createdAt: z.ZodString;
713
- modifiedAt: z.ZodString;
714
- source: z.ZodEnum<{
715
- session: "session";
716
- pdf: "pdf";
717
- }>;
718
- locked: z.ZodOptional<z.ZodBoolean>;
719
- custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
720
- type: z.ZodEnum<{
721
- polyline: "polyline";
722
- polygon: "polygon";
723
- }>;
724
- vertices: z.ZodArray<z.ZodObject<{
725
- x: z.ZodNumber;
726
- y: z.ZodNumber;
727
- }, z.core.$strip>>;
728
- strokeWidth: z.ZodDefault<z.ZodNumber>;
729
- fill: z.ZodOptional<z.ZodString>;
730
- }, z.core.$strip>, z.ZodObject<{
731
- id: z.ZodString;
732
- page: z.ZodNumber;
733
- rect: z.ZodObject<{
734
- x: z.ZodNumber;
735
- y: z.ZodNumber;
736
- width: z.ZodNumber;
737
- height: z.ZodNumber;
738
- }, z.core.$strip>;
739
- color: z.ZodString;
740
- opacity: z.ZodNumber;
741
- author: z.ZodOptional<z.ZodString>;
742
- contents: z.ZodOptional<z.ZodString>;
743
- inReplyTo: z.ZodOptional<z.ZodString>;
744
- createdAt: z.ZodString;
745
- modifiedAt: z.ZodString;
746
- source: z.ZodEnum<{
747
- session: "session";
748
- pdf: "pdf";
749
- }>;
750
- locked: z.ZodOptional<z.ZodBoolean>;
751
- custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
752
- type: z.ZodLiteral<"ink">;
753
- paths: z.ZodArray<z.ZodArray<z.ZodObject<{
754
- x: z.ZodNumber;
755
- y: z.ZodNumber;
756
- }, z.core.$strip>>>;
757
- strokeWidth: z.ZodDefault<z.ZodNumber>;
758
- }, z.core.$strip>, z.ZodObject<{
759
- id: z.ZodString;
760
- page: z.ZodNumber;
761
- rect: z.ZodObject<{
762
- x: z.ZodNumber;
763
- y: z.ZodNumber;
764
- width: z.ZodNumber;
765
- height: z.ZodNumber;
766
- }, z.core.$strip>;
767
- color: z.ZodString;
768
- opacity: z.ZodNumber;
769
- author: z.ZodOptional<z.ZodString>;
770
- contents: z.ZodOptional<z.ZodString>;
771
- inReplyTo: z.ZodOptional<z.ZodString>;
772
- createdAt: z.ZodString;
773
- modifiedAt: z.ZodString;
774
- source: z.ZodEnum<{
775
- session: "session";
776
- pdf: "pdf";
777
- }>;
778
- locked: z.ZodOptional<z.ZodBoolean>;
779
- custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
780
- type: z.ZodLiteral<"redact">;
781
- quads: z.ZodOptional<z.ZodArray<z.ZodObject<{
782
- p1: z.ZodObject<{
783
- x: z.ZodNumber;
784
- y: z.ZodNumber;
785
- }, z.core.$strip>;
786
- p2: z.ZodObject<{
787
- x: z.ZodNumber;
788
- y: z.ZodNumber;
789
- }, z.core.$strip>;
790
- p3: z.ZodObject<{
791
- x: z.ZodNumber;
792
- y: z.ZodNumber;
793
- }, z.core.$strip>;
794
- p4: z.ZodObject<{
795
- x: z.ZodNumber;
796
- y: z.ZodNumber;
797
- }, z.core.$strip>;
798
- }, z.core.$strip>>>;
799
- origin: z.ZodDefault<z.ZodEnum<{
800
- user: "user";
801
- suggested: "suggested";
802
- }>>;
803
- suggestion: z.ZodOptional<z.ZodObject<{
804
- jobId: z.ZodOptional<z.ZodString>;
805
- confidence: z.ZodNumber;
806
- reason: z.ZodOptional<z.ZodString>;
807
- explanation: z.ZodOptional<z.ZodString>;
808
- recommendation: z.ZodOptional<z.ZodEnum<{
809
- redact: "redact";
810
- review: "review";
811
- keep: "keep";
812
- }>>;
813
- }, z.core.$strip>>;
814
- overlayText: z.ZodOptional<z.ZodString>;
815
- fill: z.ZodString;
816
- }, z.core.$strip>], "type">;
817
- type Annotation = z.infer<typeof AnnotationSchema>;
818
- type AnnotationType = Annotation['type'];
819
- type AnnotationOfType<T extends AnnotationType> = Extract<Annotation, {
820
- type: T;
821
- }>;
822
- type TextMarkupAnnotation = z.infer<typeof TextMarkupSchema>;
823
- type NoteAnnotation = z.infer<typeof NoteSchema>;
824
- type FreeTextAnnotation = z.infer<typeof FreeTextSchema>;
825
- type ShapeAnnotation = z.infer<typeof ShapeSchema>;
826
- type LineAnnotation = z.infer<typeof LineSchema>;
827
- type PolyAnnotation = z.infer<typeof PolySchema>;
828
- type InkAnnotation = z.infer<typeof InkSchema>;
829
- type RedactAnnotation = z.infer<typeof RedactSchema>;
830
- type Suggestion = z.infer<typeof SuggestionSchema>;
831
- /** Keys the store fills in; callers never supply them (except an optional `id`). */
832
- type Generated = 'id' | 'createdAt' | 'modifiedAt' | 'source' | 'locked';
833
- /** Keys the store derives or defaults when absent. */
834
- type Defaulted = 'rect' | 'color' | 'opacity';
835
- /** Builds the caller-facing shape of one member from its zod input type. */
836
- type InputOf<I> = I extends unknown ? Omit<I, Generated | Defaulted> & Partial<Pick<I, Extract<Defaulted, keyof I>>> & {
837
- id?: string;
838
- } : never;
839
- type RedactInput = z.input<typeof RedactSchema>;
840
- type RedactBase = Omit<InputOf<RedactInput>, 'fill' | 'rect' | 'quads'> & {
841
- fill?: string;
842
- };
843
- type RedactCallerInput = (RedactBase & {
844
- rect: RedactInput['rect'];
845
- quads?: RedactInput['quads'];
846
- }) | (RedactBase & {
847
- rect?: RedactInput['rect'];
848
- quads: NonNullable<RedactInput['quads']>;
849
- });
850
- /**
851
- * What callers pass to `add`. Built from zod input types, so fields with defaults or
852
- * optional fields may be omitted. A redaction needs `rect` or `quads` (the store
853
- * derives the other), and `fill` defaults to the store's redaction colour.
854
- */
855
- type AnnotationInput = InputOf<z.input<typeof TextMarkupSchema> | z.input<typeof NoteSchema> | z.input<typeof FreeTextSchema> | z.input<typeof ShapeSchema> | z.input<typeof LineSchema> | z.input<typeof PolySchema> | z.input<typeof InkSchema>> | RedactCallerInput;
856
- declare const AnnotationDocumentSchema: z.ZodObject<{
857
- format: z.ZodLiteral<"inkbar/annotations">;
858
- version: z.ZodLiteral<1>;
859
- documentKey: z.ZodOptional<z.ZodString>;
860
- annotations: z.ZodArray<z.ZodUnknown>;
861
- }, z.core.$strip>;
862
- /**
863
- * An item whose `type` this version does not know, written by a newer Inkbar. It is kept as-is
864
- * so it survives an import and export round trip, and it is valid only under the schema
865
- * version that produced it.
866
- */
867
- type ForeignAnnotation = {
868
- type: string;
869
- id: string;
870
- page: number;
871
- } & Record<string, unknown>;
872
- interface AnnotationDocument {
873
- format: typeof ANNOTATION_FORMAT;
874
- version: typeof ANNOTATION_VERSION;
875
- documentKey?: string;
876
- annotations: Array<Annotation | ForeignAnnotation>;
877
- }
878
- type ConfidenceBucket = 'low' | 'medium' | 'high';
879
- declare function confidenceBucket(confidence: number): ConfidenceBucket;
880
- //#endregion
881
- //#region src/model/annotations/defaults.d.ts
882
- interface AnnotationDefaults {
883
- color(type: AnnotationType): string;
884
- /** Fill colour for redactions. */
885
- fill(): string;
886
- opacity(type: AnnotationType): number;
887
- /** Outline colour for a suggested redaction, by confidence bucket. */
888
- suggestion(bucket: ConfidenceBucket): string;
889
- }
890
- declare const staticDefaults: AnnotationDefaults;
891
- /** Resolves default colours from CSS custom properties on `el`, falling back to `staticDefaults`. */
892
- declare function cssVariableDefaults(el: Element): AnnotationDefaults;
893
- /** Accepts `#rgb`, `#rrggbb`, `rgb(r, g, b)` and `rgb(r g b)`; returns `#RRGGBB` or undefined. */
894
- declare function normalizeColor(value: string): string | undefined;
895
- //#endregion
896
- //#region src/model/annotations/embedded.d.ts
897
- declare const SUPPORTED_SUBTYPES: ReadonlySet<string>;
898
- interface EmbeddedSummary {
899
- subtype: string;
900
- count: number;
901
- supported: boolean;
902
- }
903
- declare function pdfColorToHex(c: ArrayLike<number> | null | undefined, fallback: string): string;
904
- /**
905
- * Imported ids are `pdf:<page>:<pdfjsId>` (page is 0-based, pdfjsId is the annotation's object
906
- * reference such as `12R`). They are stable across opens of the same file, and `inReplyTo`
907
- * uses the same scheme so threads resolve.
908
- */
909
- declare function importedId(page: number, pdfjsId: string): string;
910
- declare function importEmbeddedPage(page: number, raw: PdfjsAnnotationData[], importedAt: string): {
911
- annotations: Annotation[];
912
- counts: Record<string, number>;
913
- };
914
- declare function summarise(perPage: Record<string, number>[]): EmbeddedSummary[];
915
- //#endregion
916
- //#region src/model/annotations/store.d.ts
917
- type AnnotationChange = {
918
- kind: 'add';
919
- annotation: Annotation;
920
- } | {
921
- kind: 'update';
922
- id: string;
923
- before: Annotation;
924
- after: Annotation;
925
- } | {
926
- kind: 'remove';
927
- /** The annotation `remove` was called with. */
928
- annotation: Annotation;
929
- /** Everything that went: `annotation` first, then the replies removed with it. */
930
- removed: Annotation[];
931
- } | {
932
- kind: 'replace';
933
- reason: 'import' | 'sync' | 'history';
934
- };
935
- type StoreMode = {
936
- mode: 'uncontrolled';
937
- initial?: Annotation[];
938
- } | {
939
- mode: 'controlled';
940
- initial: Annotation[];
941
- onChange: (next: Annotation[], change: AnnotationChange) => void;
942
- };
943
- interface AnnotationStore {
944
- readonly mode: 'uncontrolled' | 'controlled';
945
- readonly list: Readable<readonly Annotation[]>;
946
- readonly selection: Readable<readonly string[]>;
947
- /** The colour, fill and opacity defaults new annotations get. */
948
- readonly defaults: AnnotationDefaults;
949
- get(id: string): Annotation | undefined;
950
- byPage(page: number): Annotation[];
951
- /**
952
- * Returns the completed annotation. In controlled mode it is proposed to the host, not
953
- * applied. Throws an `Error` naming the id when it is already in the list, whether it came
954
- * from `input.id` or the store's `id` generator.
955
- */
956
- add(input: AnnotationInput): Annotation;
957
- /**
958
- * `id`, `type`, `createdAt` and `source` cannot be patched, nor can `locked` on an embedded
959
- * (`source: 'pdf'`) annotation: those keys are ignored. `modifiedAt` is always bumped. A
960
- * locked annotation refuses any patch to its geometry, `page` or `contents`.
961
- */
962
- update(id: string, patch: Partial<Annotation>): Annotation | undefined;
963
- remove(id: string): boolean;
964
- select(ids: string[]): void;
965
- /**
966
- * Uncontrolled: embedded annotations survive (the list may edit them like `update` would, but
967
- * cannot drop or add them). Controlled: proposes the list minus embedded items to `onChange`.
968
- */
969
- replaceAll(list: Annotation[], reason: 'import' | 'sync' | 'history'): void;
970
- /**
971
- * Controlled mode only: the host pushes its current list. Embedded (`source: 'pdf'`) items
972
- * belong to the store, so they stay in `list` whatever the host sends; host items that reuse
973
- * an embedded id are dropped.
974
- */
975
- setControlledValue(list: Annotation[]): void;
976
- /**
977
- * @internal Replaces the annotations embedded in the file (`source: 'pdf'`). Applied
978
- * directly in both modes and never passed to `onChange`; the document calls it once on open.
979
- */
980
- _setEmbedded(list: readonly Annotation[]): void;
981
- /**
982
- * @internal Like `get`, but in controlled mode it also sees changes proposed to the host and
983
- * not applied yet: the list `update` and `remove` build on.
984
- */
985
- _getProposed(id: string): Annotation | undefined;
986
- completeInput(input: AnnotationInput): Annotation;
987
- on(event: 'change', fn: (change: AnnotationChange) => void): () => void;
988
- destroy(): void;
989
- }
990
- interface StoreOptions {
991
- mode: StoreMode;
992
- defaults: AnnotationDefaults;
993
- now?: () => string;
994
- id?: () => string;
995
- }
996
- declare function deriveRect(input: AnnotationInput): Rect;
997
- declare function createAnnotationStore(opts: StoreOptions): AnnotationStore;
998
- //#endregion
999
- //#region src/model/annotations/history.d.ts
1000
- interface History {
1001
- readonly canUndo: Readable<boolean>;
1002
- readonly canRedo: Readable<boolean>;
1003
- undo(): void;
1004
- redo(): void;
1005
- clear(): void;
1006
- /**
1007
- * Runs `fn` and records everything it changes as one undo entry. Change events still fire once
1008
- * per annotation. Nested calls join the outer batch. `fn` must be synchronous; changes after an
1009
- * `await` are not part of the batch; a dev build warns when `fn` returns a promise. A throwing
1010
- * `fn` still records what it changed, then rethrows. A batch whose list ends where it began
1011
- * (the same annotations, by identity, in the same order) records nothing and keeps redo.
1012
- * Calling `undo()` or `redo()` inside `fn` is not supported. On a controlled or destroyed
1013
- * history this only runs `fn`, and a history destroyed inside `fn` records nothing.
1014
- */
1015
- batch(fn: () => void): void;
1016
- /** Unsubscribes from the store and empties both stacks; undo and redo become no-ops. */
1017
- destroy(): void;
1018
- }
1019
- /**
1020
- * Snapshot-based undo and redo over an uncontrolled store.
1021
- *
1022
- * In controlled mode the host owns the list, so history is the host's concern (the Vue layer
1023
- * offers `useHistory`). There `createHistory` returns an inert History: `canUndo` and `canRedo`
1024
- * stay false, `undo` and `redo` do nothing, and nothing is recorded.
1025
- */
1026
- declare function createHistory(store: AnnotationStore, opts?: {
1027
- limit?: number;
1028
- }): History;
1029
- //#endregion
1030
- //#region src/model/annotations/json.d.ts
1031
- interface ImportResult {
1032
- imported: number;
1033
- /**
1034
- * Items whose `type` this version does not know (they still need a string `id` and a numeric
1035
- * `page`). Keep them and pass them back to exportAnnotations.
1036
- */
1037
- unknown: ForeignAnnotation[];
1038
- errors: {
1039
- index: number;
1040
- issues: string[];
1041
- }[];
1042
- }
1043
- interface ImportOptions {
1044
- /** `replace` drops every session annotation first; `merge` overwrites by id and keeps the rest. */
1045
- mode: 'replace' | 'merge';
1046
- }
1047
- /**
1048
- * Session annotations plus any preserved foreign items. Embedded (`source: 'pdf'`) ones stay in
1049
- * the file.
1050
- *
1051
- * The result is a JSON copy (`JSON.parse(JSON.stringify(...))`), the same data a serialised
1052
- * export would carry: editing it never touches the store, and values JSON cannot hold, such as
1053
- * functions or `undefined` inside `custom`, are left out exactly as `JSON.stringify` would.
1054
- *
1055
- * Without foreign items the result validates against this version's `schema.json`. With them it
1056
- * validates only against the newer schema that produced them, since this version's schema
1057
- * describes only the types it knows.
1058
- */
1059
- declare function exportAnnotations(store: AnnotationStore, preserved?: readonly ForeignAnnotation[], documentKey?: string): AnnotationDocument;
1060
- /**
1061
- * Validates the envelope (throws a TypeError when it is not an inkbar/annotations v1 document),
1062
- * then each item on its own. Embedded annotations are never touched; imported items become
1063
- * session annotations.
1064
- */
1065
- declare function importAnnotations(store: AnnotationStore, data: AnnotationDocument | string, opts: ImportOptions): ImportResult;
1066
- //#endregion
1067
- //#region src/model/errors.d.ts
1068
- type InkErrorCode = 'PasswordRequired' | 'InvalidPdf' | 'SourceFetchFailed' | 'AssetConfigMissing' | 'AssetLoadFailed' | 'EngineUnavailable' | 'ControlledMutationIgnored' | 'DocumentDestroyed' | 'PageOutOfRange';
1069
- declare class InkError extends Error {
1070
- readonly name = "InkError";
1071
- readonly code: InkErrorCode;
1072
- readonly details: Readonly<Record<string, unknown>>;
1073
- constructor(code: InkErrorCode, message: string, details?: Record<string, unknown>, cause?: unknown);
1074
- }
1075
- declare function isInkError(value: unknown): value is InkError;
1076
- //#endregion
1077
- //#region src/model/source.d.ts
1078
- type DocumentSource = ArrayBuffer | Uint8Array | Blob | string | {
1079
- url: string;
1080
- key: string;
1081
- } | {
1082
- data: ArrayBuffer | Uint8Array;
1083
- key: string;
1084
- };
1085
- //#endregion
1086
- //#region src/model/text.d.ts
1087
- interface TextItem {
1088
- str: string;
1089
- dir: 'ltr' | 'rtl' | 'ttb';
1090
- fontName: string;
1091
- fontSize: number;
1092
- hasEOL: boolean;
1093
- /** Glyph-run box in user space, following the run's rotation. */
1094
- quad: Quad;
1095
- /** Axis-aligned bounds of `quad`. */
1096
- rect: Rect;
1097
- }
1098
- interface TextContent {
1099
- page: number;
1100
- items: TextItem[];
1101
- }
1102
- //#endregion
1103
- //#region src/model/document.d.ts
1104
- type DocumentStatus = {
1105
- state: 'loading';
1106
- } | {
1107
- state: 'ready';
1108
- } | {
1109
- state: 'error';
1110
- error: InkError;
1111
- };
1112
- /** A document's status plus `idle`, for a host with no document open. */
1113
- type InkStatus = DocumentStatus | {
1114
- state: 'idle';
1115
- };
1116
- interface DocumentInfo {
1117
- title?: string | undefined;
1118
- author?: string | undefined;
1119
- pageCount: number;
1120
- isEncrypted: boolean;
1121
- }
1122
- interface OpenOptions {
1123
- assets: PdfAssets;
1124
- password?: string | undefined;
1125
- fetch?: typeof fetch | undefined;
1126
- /**
1127
- * Defaults to uncontrolled. In controlled mode the host owns only session annotations:
1128
- * embedded (`source: 'pdf'`) ones live in the store, are never passed to `onChange`, and stay
1129
- * in `list` whatever the host pushes back.
1130
- */
1131
- annotations?: StoreMode | undefined;
1132
- /** Colour defaults. Pass `cssVariableDefaults(element)` from the DOM layer to read theme variables. */
1133
- defaults?: AnnotationDefaults | undefined;
1134
- /**
1135
- * Undo history, on by default. `false` disables it. In controlled mode history is always
1136
- * inert: the host owns the list, so it owns undo too.
1137
- */
1138
- history?: boolean | {
1139
- limit?: number | undefined;
1140
- } | undefined;
1141
- /** PDF.js verbosity level; 0 = errors only. Defaults to PDF.js's own level. */
1142
- verbosity?: number | undefined;
1143
- }
1144
- interface InkDocument {
1145
- readonly key: string;
1146
- readonly status: Readable<DocumentStatus>;
1147
- /** Resolves when status is ready; rejects with the InkError when it is error. */
1148
- readonly ready: Promise<void>;
1149
- readonly pages: readonly PageInfo[];
1150
- readonly info: DocumentInfo;
1151
- text(page: number): Promise<TextContent>;
1152
- /**
1153
- * Annotations embedded in the file arrive here as `source: 'pdf'`, `locked: true` before
1154
- * `ready` resolves. They stay in `list` in both modes and cannot be removed; in controlled
1155
- * mode they never reach `onChange`.
1156
- */
1157
- readonly annotations: AnnotationStore;
1158
- /** What the file contained, by PDF subtype, including subtypes Inkbar does not show. */
1159
- readonly embedded: readonly EmbeddedSummary[];
1160
- readonly history: History;
1161
- /** Session annotations only, plus unknown-type items kept from earlier imports. */
1162
- exportAnnotations(format: 'json'): AnnotationDocument;
1163
- /** Defaults to `{ mode: 'replace' }`. Embedded annotations are never touched. */
1164
- importAnnotations(data: AnnotationDocument | string, opts?: ImportOptions): ImportResult;
1165
- /** Writes the document with its annotations. Needs @inkbar/engine; rejects with EngineUnavailable otherwise. */
1166
- save(): Promise<Uint8Array>;
1167
- destroy(): void;
1168
- /** @internal PDF.js handles for the DOM layer. Not part of the public contract. */
1169
- readonly _pdfjs: {
1170
- module: PdfjsModule;
1171
- proxy: PdfjsDocument;
1172
- getPage(index: number): Promise<PdfjsPage>;
1173
- };
1174
- }
1175
- /**
1176
- * Opens a document. Resolves once loading has finished, whether it succeeded or not:
1177
- * check `status` or await `ready`, which rejects with the InkError. Only a missing
1178
- * `assets` option (a programmer error) makes this promise itself reject.
1179
- */
1180
- declare function openDocument(source: DocumentSource, options: OpenOptions): Promise<InkDocument>;
1181
- //#endregion
1182
- export { NoteAnnotation as $, summarise as A, multiplyMatrix as At, AnnotationInput as B, unionRects as Bt, createAnnotationStore as C, Matrix as Ct, importEmbeddedPage as D, applyMatrix as Dt, SUPPORTED_SUBTYPES as E, Rect as Et, ANNOTATION_FORMAT as F, rectFromPoints as Ft, ForeignAnnotation as G, AnnotationSchema as H, ANNOTATION_VERSION as I, rectFromQuad as It, InkAnnotation as J, FreeTextAnnotation as K, Annotation as L, rectsIntersect as Lt, cssVariableDefaults as M, quadFromRect as Mt, normalizeColor as N, quadsFromFlat as Nt, importedId as O, approxEqual as Ot, staticDefaults as P, rectContainsPoint as Pt, LineSchema as Q, AnnotationDocument as R, translateQuad as Rt, StoreOptions as S, PdfAssets as St, EmbeddedSummary as T, Quad as Tt, AnnotationType as U, AnnotationOfType as V, ConfidenceBucket as W, LineAnnotation as X, InkSchema as Y, LineEndingSchema as Z, History as _, derived as _t, OpenOptions as a, RectSchema as at, AnnotationStore as b, PageInfo as bt, TextItem as c, ShapeAnnotation as ct, InkErrorCode as d, SuggestionSchema as dt, NoteSchema as et, isInkError as f, TextMarkupAnnotation as ft, importAnnotations as g, Writable as gt, exportAnnotations as h, Readable as ht, InkStatus as i, QuadSchema as it, AnnotationDefaults as j, pointsFromFlat as jt, pdfColorToHex as k, invertMatrix as kt, DocumentSource as l, ShapeSchema as lt, ImportResult as m, confidenceBucket as mt, DocumentStatus as n, PolyAnnotation as nt, openDocument as o, RedactAnnotation as ot, ImportOptions as p, TextMarkupSchema as pt, FreeTextSchema as q, InkDocument as r, PolySchema as rt, TextContent as s, RedactSchema as st, DocumentInfo as t, PointSchema as tt, InkError as u, Suggestion as ut, createHistory as v, readonly as vt, deriveRect as w, Point as wt, StoreMode as x, PageRotation as xt, AnnotationChange as y, writable as yt, AnnotationDocumentSchema as z, translateRect as zt };
1183
- //# sourceMappingURL=document-Cywnv8Sz.d.mts.map