@arbidocs/react 0.4.70 → 0.4.71
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/README.md +6 -4
- package/dist/ProductionDialog-BRrZ5Lj5.d.cts +84 -0
- package/dist/ProductionDialog-DUC9BXWS.d.ts +84 -0
- package/dist/annotations/freeze/index.cjs +45 -1100
- package/dist/annotations/freeze/index.cjs.map +1 -1
- package/dist/annotations/freeze/index.d.cts +2 -85
- package/dist/annotations/freeze/index.d.ts +2 -85
- package/dist/annotations/freeze/index.js +4 -1084
- package/dist/annotations/freeze/index.js.map +1 -1
- package/dist/annotations/index.d.cts +3 -51
- package/dist/annotations/index.d.ts +3 -51
- package/dist/artifacts/index.cjs +9 -9
- package/dist/artifacts/index.js +2 -2
- package/dist/bundle-BnCSbHy2.d.cts +85 -0
- package/dist/bundle-BnCSbHy2.d.ts +85 -0
- package/dist/bundle-N2JIJ2T6.js +4 -0
- package/dist/bundle-N2JIJ2T6.js.map +1 -0
- package/dist/bundle-T6BEVYHE.cjs +13 -0
- package/dist/bundle-T6BEVYHE.cjs.map +1 -0
- package/dist/{chunk-SYPUFZGA.js → chunk-6ERJUIMQ.js} +3 -3
- package/dist/{chunk-SYPUFZGA.js.map → chunk-6ERJUIMQ.js.map} +1 -1
- package/dist/{chunk-7CL7QHT6.cjs → chunk-6TFD5OS5.cjs} +25 -25
- package/dist/{chunk-7CL7QHT6.cjs.map → chunk-6TFD5OS5.cjs.map} +1 -1
- package/dist/{chunk-ZMTLGO3K.cjs → chunk-IIT7DMQL.cjs} +6 -2
- package/dist/chunk-IIT7DMQL.cjs.map +1 -0
- package/dist/chunk-QJXFRP5R.cjs +1103 -0
- package/dist/chunk-QJXFRP5R.cjs.map +1 -0
- package/dist/{chunk-J4MX2W4H.js → chunk-WBYNKFUO.js} +6 -3
- package/dist/chunk-WBYNKFUO.js.map +1 -0
- package/dist/chunk-ZJMUNGOY.js +1088 -0
- package/dist/chunk-ZJMUNGOY.js.map +1 -0
- package/dist/document-tools/index.cjs +223 -8
- package/dist/document-tools/index.cjs.map +1 -1
- package/dist/document-tools/index.d.cts +139 -9
- package/dist/document-tools/index.d.ts +139 -9
- package/dist/document-tools/index.js +207 -9
- package/dist/document-tools/index.js.map +1 -1
- package/dist/index.cjs +153 -149
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +6 -6
- package/dist/ui/index.cjs +9 -9
- package/dist/ui/index.js +1 -1
- package/dist/viewers/index.cjs +2 -2
- package/dist/viewers/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-J4MX2W4H.js.map +0 -1
- package/dist/chunk-ZMTLGO3K.cjs.map +0 -1
- package/dist/store-CqkkD7Ho.d.cts +0 -35
- package/dist/store-D1nhbkgk.d.ts +0 -35
package/README.md
CHANGED
|
@@ -135,10 +135,12 @@ stored.
|
|
|
135
135
|
|
|
136
136
|
## PDF document tools (`@arbidocs/react/document-tools`)
|
|
137
137
|
|
|
138
|
-
The data side of annotation, markup, freeze, e-signing and
|
|
139
|
-
(the host's API client, user and callbacks
|
|
140
|
-
|
|
141
|
-
`
|
|
138
|
+
The data side of annotation, markup, freeze, e-signing, signature checking and production sets:
|
|
139
|
+
`DocumentToolsProvider` (the host's API client, user and callbacks; `deploymentDomain` defaults to
|
|
140
|
+
the enclosing `ArbiProvider`'s, `useDeploymentDomain()`), `fetchDocumentPdf` (a version's `/view`
|
|
141
|
+
PDF), `useDocumentMarkup`, `createMarkupStore` (an `AnnotationStore` over the server markup, with
|
|
142
|
+
409 merge), `fetchMarkupPdf`, `useDocumentSignatures`, `useSignDocument`,
|
|
143
|
+
`useSignatureVerification` and `buildProduction` / `saveProductionFiles`. The UI is `@arbidocs/blocks/document-tools`; see
|
|
142
144
|
"Using the document tools in another frontend" in the `@arbidocs/blocks` README.
|
|
143
145
|
|
|
144
146
|
## Streaming callbacks
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { b as AnnotationLayer } from './model-DIwXRuGC.cjs';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Where a layer is kept. The layer is data about a document, not part of it, so the host decides
|
|
6
|
+
* (backend API, IndexedDB, a file). This package ships an in-memory store and a localStorage
|
|
7
|
+
* store; both validate on load because stored JSON is untrusted. A store shared by several
|
|
8
|
+
* writers (ARBI's server-side markup) also implements the optional members: it may merge on save,
|
|
9
|
+
* pull others' changes, and say whether this user may write at all.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
interface AnnotationStore {
|
|
13
|
+
/** The saved layer, or an empty one for a document that has none yet. */
|
|
14
|
+
load(documentId: string): Promise<AnnotationLayer>;
|
|
15
|
+
/**
|
|
16
|
+
* Write a layer. A store with other writers may resolve to what it actually saved — this layer
|
|
17
|
+
* merged with theirs (see `mergeLayers`); the caller then rebases its newer edits onto it.
|
|
18
|
+
*/
|
|
19
|
+
save(layer: AnnotationLayer): Promise<AnnotationLayer | void>;
|
|
20
|
+
/** Others' changes since the last load or save, or null when there are none. */
|
|
21
|
+
pull?(documentId: string): Promise<AnnotationLayer | null>;
|
|
22
|
+
/** Whether this user may change the layer; false makes it view-only. Known after `load`. */
|
|
23
|
+
canEdit?(documentId: string): boolean;
|
|
24
|
+
}
|
|
25
|
+
/** Thrown by a store whose backend cannot be reached: the layer is kept and saved when back. */
|
|
26
|
+
declare class AnnotationStoreOfflineError extends Error {
|
|
27
|
+
constructor(message?: string);
|
|
28
|
+
}
|
|
29
|
+
declare function createMemoryStore(now?: () => string): AnnotationStore;
|
|
30
|
+
/**
|
|
31
|
+
* Per-browser store. Storage can be absent, full or blocked (private windows), so every access is
|
|
32
|
+
* guarded. A saved layer that no longer validates is ignored rather than crashing the viewer.
|
|
33
|
+
*/
|
|
34
|
+
declare function createLocalStorageStore(storage?: Pick<Storage, 'getItem' | 'setItem'> | undefined, now?: () => string): AnnotationStore;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Asks how to number and package a set of documents as a production. It only collects choices; the
|
|
38
|
+
* host runs `buildBundle` (see `@arbidocs/react/annotations/freeze`) and saves the result.
|
|
39
|
+
*
|
|
40
|
+
* The documents can be put in order (drag a row, or its up/down buttons from the keyboard): that
|
|
41
|
+
* order is the numbering order.
|
|
42
|
+
*/
|
|
43
|
+
type ProductionCorner = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
44
|
+
interface ProductionChoices {
|
|
45
|
+
layout: 'merged' | 'per-document';
|
|
46
|
+
prefix: string;
|
|
47
|
+
start: number;
|
|
48
|
+
digits: number;
|
|
49
|
+
/** Corner of the Bates label; the QR code, when on, takes the opposite bottom corner. */
|
|
50
|
+
corner: ProductionCorner;
|
|
51
|
+
qr: boolean;
|
|
52
|
+
/** An index page first: every document with its Bates range. */
|
|
53
|
+
indexPage: boolean;
|
|
54
|
+
/** Also save the result as a document in the workspace (it is downloaded either way). */
|
|
55
|
+
saveToWorkspace: boolean;
|
|
56
|
+
/** Document ids in numbering order. */
|
|
57
|
+
order: string[];
|
|
58
|
+
}
|
|
59
|
+
interface ProductionDocument {
|
|
60
|
+
id: string;
|
|
61
|
+
name: string;
|
|
62
|
+
}
|
|
63
|
+
interface ProductionDialogProps {
|
|
64
|
+
open: boolean;
|
|
65
|
+
onOpenChange: (open: boolean) => void;
|
|
66
|
+
/** The documents, in the order they are numbered until the user reorders them. */
|
|
67
|
+
documents: ProductionDocument[];
|
|
68
|
+
/** Selected documents that cannot be included, with the reason, e.g. "photo.jpg (no PDF)". */
|
|
69
|
+
leftOut?: string[];
|
|
70
|
+
onConfirm: (choices: ProductionChoices) => void;
|
|
71
|
+
busy?: boolean;
|
|
72
|
+
progress?: {
|
|
73
|
+
done: number;
|
|
74
|
+
total: number;
|
|
75
|
+
} | null;
|
|
76
|
+
error?: string | null;
|
|
77
|
+
}
|
|
78
|
+
/** The QR code sits in the bottom corner the label is not in (the label may be top or bottom). */
|
|
79
|
+
declare function qrCornerFor(corner: ProductionCorner): ProductionCorner;
|
|
80
|
+
/** `items` with the entry at `from` moved to `to`. */
|
|
81
|
+
declare function moveItem<T>(items: readonly T[], from: number, to: number): T[];
|
|
82
|
+
declare function ProductionDialog({ open, onOpenChange, documents, leftOut, onConfirm, busy, progress, error, }: ProductionDialogProps): React.JSX.Element;
|
|
83
|
+
|
|
84
|
+
export { type AnnotationStore as A, type ProductionChoices as P, AnnotationStoreOfflineError as a, type ProductionCorner as b, ProductionDialog as c, type ProductionDialogProps as d, type ProductionDocument as e, createLocalStorageStore as f, createMemoryStore as g, moveItem as m, qrCornerFor as q };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { b as AnnotationLayer } from './model-DIwXRuGC.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Where a layer is kept. The layer is data about a document, not part of it, so the host decides
|
|
6
|
+
* (backend API, IndexedDB, a file). This package ships an in-memory store and a localStorage
|
|
7
|
+
* store; both validate on load because stored JSON is untrusted. A store shared by several
|
|
8
|
+
* writers (ARBI's server-side markup) also implements the optional members: it may merge on save,
|
|
9
|
+
* pull others' changes, and say whether this user may write at all.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
interface AnnotationStore {
|
|
13
|
+
/** The saved layer, or an empty one for a document that has none yet. */
|
|
14
|
+
load(documentId: string): Promise<AnnotationLayer>;
|
|
15
|
+
/**
|
|
16
|
+
* Write a layer. A store with other writers may resolve to what it actually saved — this layer
|
|
17
|
+
* merged with theirs (see `mergeLayers`); the caller then rebases its newer edits onto it.
|
|
18
|
+
*/
|
|
19
|
+
save(layer: AnnotationLayer): Promise<AnnotationLayer | void>;
|
|
20
|
+
/** Others' changes since the last load or save, or null when there are none. */
|
|
21
|
+
pull?(documentId: string): Promise<AnnotationLayer | null>;
|
|
22
|
+
/** Whether this user may change the layer; false makes it view-only. Known after `load`. */
|
|
23
|
+
canEdit?(documentId: string): boolean;
|
|
24
|
+
}
|
|
25
|
+
/** Thrown by a store whose backend cannot be reached: the layer is kept and saved when back. */
|
|
26
|
+
declare class AnnotationStoreOfflineError extends Error {
|
|
27
|
+
constructor(message?: string);
|
|
28
|
+
}
|
|
29
|
+
declare function createMemoryStore(now?: () => string): AnnotationStore;
|
|
30
|
+
/**
|
|
31
|
+
* Per-browser store. Storage can be absent, full or blocked (private windows), so every access is
|
|
32
|
+
* guarded. A saved layer that no longer validates is ignored rather than crashing the viewer.
|
|
33
|
+
*/
|
|
34
|
+
declare function createLocalStorageStore(storage?: Pick<Storage, 'getItem' | 'setItem'> | undefined, now?: () => string): AnnotationStore;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Asks how to number and package a set of documents as a production. It only collects choices; the
|
|
38
|
+
* host runs `buildBundle` (see `@arbidocs/react/annotations/freeze`) and saves the result.
|
|
39
|
+
*
|
|
40
|
+
* The documents can be put in order (drag a row, or its up/down buttons from the keyboard): that
|
|
41
|
+
* order is the numbering order.
|
|
42
|
+
*/
|
|
43
|
+
type ProductionCorner = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
44
|
+
interface ProductionChoices {
|
|
45
|
+
layout: 'merged' | 'per-document';
|
|
46
|
+
prefix: string;
|
|
47
|
+
start: number;
|
|
48
|
+
digits: number;
|
|
49
|
+
/** Corner of the Bates label; the QR code, when on, takes the opposite bottom corner. */
|
|
50
|
+
corner: ProductionCorner;
|
|
51
|
+
qr: boolean;
|
|
52
|
+
/** An index page first: every document with its Bates range. */
|
|
53
|
+
indexPage: boolean;
|
|
54
|
+
/** Also save the result as a document in the workspace (it is downloaded either way). */
|
|
55
|
+
saveToWorkspace: boolean;
|
|
56
|
+
/** Document ids in numbering order. */
|
|
57
|
+
order: string[];
|
|
58
|
+
}
|
|
59
|
+
interface ProductionDocument {
|
|
60
|
+
id: string;
|
|
61
|
+
name: string;
|
|
62
|
+
}
|
|
63
|
+
interface ProductionDialogProps {
|
|
64
|
+
open: boolean;
|
|
65
|
+
onOpenChange: (open: boolean) => void;
|
|
66
|
+
/** The documents, in the order they are numbered until the user reorders them. */
|
|
67
|
+
documents: ProductionDocument[];
|
|
68
|
+
/** Selected documents that cannot be included, with the reason, e.g. "photo.jpg (no PDF)". */
|
|
69
|
+
leftOut?: string[];
|
|
70
|
+
onConfirm: (choices: ProductionChoices) => void;
|
|
71
|
+
busy?: boolean;
|
|
72
|
+
progress?: {
|
|
73
|
+
done: number;
|
|
74
|
+
total: number;
|
|
75
|
+
} | null;
|
|
76
|
+
error?: string | null;
|
|
77
|
+
}
|
|
78
|
+
/** The QR code sits in the bottom corner the label is not in (the label may be top or bottom). */
|
|
79
|
+
declare function qrCornerFor(corner: ProductionCorner): ProductionCorner;
|
|
80
|
+
/** `items` with the entry at `from` moved to `to`. */
|
|
81
|
+
declare function moveItem<T>(items: readonly T[], from: number, to: number): T[];
|
|
82
|
+
declare function ProductionDialog({ open, onOpenChange, documents, leftOut, onConfirm, busy, progress, error, }: ProductionDialogProps): React.JSX.Element;
|
|
83
|
+
|
|
84
|
+
export { type AnnotationStore as A, type ProductionChoices as P, AnnotationStoreOfflineError as a, type ProductionCorner as b, ProductionDialog as c, type ProductionDialogProps as d, type ProductionDocument as e, createLocalStorageStore as f, createMemoryStore as g, moveItem as m, qrCornerFor as q };
|