@arbidocs/blocks 0.4.68 → 0.4.70
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 +85 -1
- package/dist/agents/index.cjs +220 -220
- package/dist/agents/index.js +4 -4
- package/dist/chat/index.cjs +66 -66
- package/dist/chat/index.js +2 -2
- package/dist/chunk-4DVEGXZQ.cjs +72 -0
- package/dist/chunk-4DVEGXZQ.cjs.map +1 -0
- package/dist/{chunk-5ZZCS2EK.cjs → chunk-7M22KND4.cjs} +5 -5
- package/dist/{chunk-5ZZCS2EK.cjs.map → chunk-7M22KND4.cjs.map} +1 -1
- package/dist/{chunk-ZQB7HNE6.js → chunk-BMWZTNZB.js} +3 -3
- package/dist/{chunk-ZQB7HNE6.js.map → chunk-BMWZTNZB.js.map} +1 -1
- package/dist/{chunk-FAVN6VUR.js → chunk-HLMFU7L2.js} +5 -5
- package/dist/{chunk-FAVN6VUR.js.map → chunk-HLMFU7L2.js.map} +1 -1
- package/dist/chunk-ODWCTAH7.js +66 -0
- package/dist/chunk-ODWCTAH7.js.map +1 -0
- package/dist/{chunk-WKNAFILY.cjs → chunk-XNRGCQPZ.cjs} +3 -3
- package/dist/{chunk-WKNAFILY.cjs.map → chunk-XNRGCQPZ.cjs.map} +1 -1
- package/dist/document-tools/DocumentToolButtons.d.ts +29 -0
- package/dist/document-tools/MarkupNotices.d.ts +12 -0
- package/dist/document-tools/MarkupViewNote.d.ts +11 -0
- package/dist/document-tools/SignDocumentDialog.d.ts +20 -0
- package/dist/document-tools/SignatureCertificate.d.ts +26 -0
- package/dist/document-tools/SignatureStatus.d.ts +22 -0
- package/dist/document-tools/VersionSnapshotBar.d.ts +27 -0
- package/dist/document-tools/index.cjs +633 -0
- package/dist/document-tools/index.cjs.map +1 -0
- package/dist/document-tools/index.d.ts +7 -0
- package/dist/document-tools/index.js +619 -0
- package/dist/document-tools/index.js.map +1 -0
- package/dist/document-tools/viewer/AnnotatedPdfViewer.d.ts +54 -0
- package/dist/document-tools/viewer/SignaturePlacementViewer.d.ts +20 -0
- package/dist/document-tools/viewer/index.cjs +273 -0
- package/dist/document-tools/viewer/index.cjs.map +1 -0
- package/dist/document-tools/viewer/index.d.ts +2 -0
- package/dist/document-tools/viewer/index.js +268 -0
- package/dist/document-tools/viewer/index.js.map +1 -0
- package/dist/facts/index.cjs +1 -1
- package/dist/facts/index.js +1 -1
- package/dist/files/cells/DocumentNameCell.d.ts +3 -1
- package/dist/files/index.cjs +38 -67
- package/dist/files/index.cjs.map +1 -1
- package/dist/files/index.js +19 -63
- package/dist/files/index.js.map +1 -1
- package/dist/home/index.cjs +1 -1
- package/dist/home/index.js +1 -1
- package/dist/index.cjs +651 -651
- package/dist/index.js +10 -10
- package/dist/settings/index.cjs +2 -2
- package/dist/settings/index.js +2 -2
- package/dist/shell/index.cjs +1 -1
- package/dist/shell/index.js +1 -1
- package/dist/studio/index.cjs +1 -1
- package/dist/studio/index.js +1 -1
- package/package.json +20 -4
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Optional peers, only needed for the entry that uses them:
|
|
|
19
19
|
|
|
20
20
|
| Peer | Needed by |
|
|
21
21
|
| --- | --- |
|
|
22
|
-
| `@tanstack/react-query` | `@arbidocs/blocks/connect`, `@arbidocs/blocks/studio` |
|
|
22
|
+
| `@tanstack/react-query` | `@arbidocs/blocks/connect`, `@arbidocs/blocks/studio`, `@arbidocs/blocks/document-tools` |
|
|
23
23
|
| `react-router-dom` | `@arbidocs/blocks/studio` |
|
|
24
24
|
| `@measured/puck` | `@arbidocs/blocks/studio` |
|
|
25
25
|
| `@playwright/test` | types of `@arbidocs/blocks/record` (no runtime import) |
|
|
@@ -67,6 +67,8 @@ Every capability is its own entry, so a bundler only loads what you use:
|
|
|
67
67
|
| `/files`, `/facts` | document grid, facts table | `ag-grid-*` |
|
|
68
68
|
| `/artifacts` | artifact editor, version bar, track changes | none |
|
|
69
69
|
| `/artifacts/editor` | rich-text (markdown) editing surface | `@mdxeditor/editor` (optional peer) |
|
|
70
|
+
| `/document-tools` | PDF markup, signing and version parts (see below) | `@tanstack/react-query` |
|
|
71
|
+
| `/document-tools/viewer` | annotated PDF viewer, signature placement | `pdf-lib`, `react-pdf` (optional peers of `@arbidocs/react`) |
|
|
70
72
|
| `/home`, `/workspaces` | dashboard, workspace cards and forms | `@dnd-kit/*` |
|
|
71
73
|
| `/settings` | settings, billing, modals | `cmdk` |
|
|
72
74
|
| `/connect` | demo/live connection layer | `@tanstack/react-query` |
|
|
@@ -157,6 +159,88 @@ draft is stored and parsed, then the editor on the stored version (the presentat
|
|
|
157
159
|
<StreamedArtifact artifacts={task.artifacts} workspaceId={workspaceId} busy={task.status === 'running'} error={task.error} />
|
|
158
160
|
```
|
|
159
161
|
|
|
162
|
+
## Using the document tools in another frontend
|
|
163
|
+
|
|
164
|
+
The PDF document tools are what ARBI's document page uses: annotate (highlight, comment, stamp,
|
|
165
|
+
redact) with the marks saved as the version's markup on the server (autosave, colleagues' edits
|
|
166
|
+
merged in), "Show original", "Download with markup", the notes about markup on an older version
|
|
167
|
+
("Copy open comments here") and about marks left in this browser, Freeze (a separate annotated or
|
|
168
|
+
redacted copy, with a redaction log), e-signing (choose where the signature goes, sign with the
|
|
169
|
+
password; only the signature and optionally the date are drawn), the signature details with "View
|
|
170
|
+
certificate", the public certificate page, and the read-only version bar.
|
|
171
|
+
|
|
172
|
+
| Import | What |
|
|
173
|
+
| --- | --- |
|
|
174
|
+
| `@arbidocs/react/document-tools` | `DocumentToolsProvider`, `useDocumentMarkup`, `createMarkupStore`, `fetchMarkupPdf`, `canAnnotate`, `useDocumentSignatures`, `useSignDocument`, `useSignatureVerification` |
|
|
175
|
+
| `@arbidocs/blocks/document-tools` | `AnnotateButton`, `ShowOriginalButton`, `DownloadMarkupButton`, `SignButton`, `MarkupNotices`, `MarkupViewNote`, `SignDocumentDialog`, `SignatureStatus`, `SignatureCertificate`, `VersionSnapshotBar` |
|
|
176
|
+
| `@arbidocs/blocks/document-tools/viewer` | `AnnotatedPdfViewer`, `SignaturePlacementViewer` (load lazily: pdf-lib) |
|
|
177
|
+
|
|
178
|
+
What the host provides, once, around the viewer (the tools import no store, router or toast
|
|
179
|
+
library of their own):
|
|
180
|
+
|
|
181
|
+
- an ARBI API client signed in as the user: `arbi.getClient().fetch` from an `@arbidocs/sdk`
|
|
182
|
+
`Arbi`, or `createArbiClient(...).fetch` from `@arbidocs/client`;
|
|
183
|
+
- `deploymentDomain` (the one the user's keys are derived for) and `user: { name, email }`, for
|
|
184
|
+
signing; without a user marks are authored as "You";
|
|
185
|
+
- callbacks, all optional: `notify(message, kind, { description, action })`, `openDocument(ref)`
|
|
186
|
+
(the copy just frozen, the signed copy), `onDocumentsChanged(ids, 'markup' | 'copy' | 'signed')`
|
|
187
|
+
to refresh your lists, `emailDocument(ref)` (adds "Email it" after signing), `uploadDocument`,
|
|
188
|
+
`saveFile` and `certificateUrl` (defaults: the API client, a download link, `/verify/{ref}`);
|
|
189
|
+
- a React Query `QueryClientProvider`, the blocks styles (see Styles), and the pdf.js assets the
|
|
190
|
+
kit `PdfViewer` loads (`/pdf.worker.min.mjs`, `/cmaps/`, `/standard_fonts/` by default) plus the
|
|
191
|
+
optional peers `react-pdf`, `pdfjs-dist` and `pdf-lib`.
|
|
192
|
+
|
|
193
|
+
```tsx
|
|
194
|
+
import { lazy, Suspense, useState } from 'react'
|
|
195
|
+
import { DocumentToolsProvider, useDocumentMarkup, useDocumentSignatures } from '@arbidocs/react/document-tools'
|
|
196
|
+
import { AnnotateButton, MarkupNotices, SignatureStatus } from '@arbidocs/blocks/document-tools'
|
|
197
|
+
const AnnotatedPdfViewer = lazy(() =>
|
|
198
|
+
import('@arbidocs/blocks/document-tools/viewer').then((m) => ({ default: m.AnnotatedPdfViewer })))
|
|
199
|
+
|
|
200
|
+
<DocumentToolsProvider
|
|
201
|
+
client={arbi.getClient().fetch}
|
|
202
|
+
deploymentDomain={deploymentDomain}
|
|
203
|
+
user={{ name: 'Ana Lopez', email: 'ana@firm.example' }}
|
|
204
|
+
notify={(message, kind) => toast[kind](message)}
|
|
205
|
+
openDocument={(ref) => navigate(`/documents/${ref}`)}
|
|
206
|
+
onDocumentsChanged={() => queryClient.invalidateQueries({ queryKey: ['documents'] })}
|
|
207
|
+
>
|
|
208
|
+
<DocumentPage doc={doc} pdf={pdfBlob} />
|
|
209
|
+
</DocumentToolsProvider>
|
|
210
|
+
|
|
211
|
+
function DocumentPage({ doc, pdf }) {
|
|
212
|
+
// `doc` is the document record (DocResponse): external_id, shared, folder, current_version, versions.
|
|
213
|
+
const [editing, setEditing] = useState(false)
|
|
214
|
+
const markup = useDocumentMarkup(doc, undefined)
|
|
215
|
+
const { data: signatures } = useDocumentSignatures(doc.external_id)
|
|
216
|
+
return (
|
|
217
|
+
<>
|
|
218
|
+
<AnnotateButton active={editing} onClick={() => setEditing((on) => !on)} />
|
|
219
|
+
{signatures?.signed && <SignatureStatus status={signatures} />}
|
|
220
|
+
<MarkupNotices legacyPrompt={markup.legacyPrompt} olderNote={markup.olderNote}
|
|
221
|
+
onOpenVersion={(n) => navigate(`/documents/${doc.external_id}@v${n}`)} />
|
|
222
|
+
<Suspense fallback={null}>
|
|
223
|
+
<AnnotatedPdfViewer file={pdf} documentId={doc.external_id} fileName={doc.file_name}
|
|
224
|
+
shared={!!doc.shared} folder={doc.folder} editing={editing}
|
|
225
|
+
onMarkupChange={markup.onMarkupChange} />
|
|
226
|
+
</Suspense>
|
|
227
|
+
</>
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
A signed version is locked: only a further signature changes it. Pass `signed` to
|
|
233
|
+
`AnnotatedPdfViewer` and a `disabledReason` (`SIGNED_LOCKED_REASON`, from `isSignedVersion(doc)` or
|
|
234
|
+
the signature status) to `DownloadMarkupButton`: marks stay in the markup layer and are never
|
|
235
|
+
written into its PDF, and the plain download is the signed file. Show `SignedEditNote` above any
|
|
236
|
+
editor of a signed version ("Editing creates a new unsigned version").
|
|
237
|
+
|
|
238
|
+
`AnnotatedPdfViewer` and `SignaturePlacementViewer` take your own binding of the kit viewer as
|
|
239
|
+
`viewer` (for example one that reports the visible page); `SignaturePlacementViewer`'s
|
|
240
|
+
`onContinue(appearance)` hands the box to `SignDocumentDialog`. Serve `SignatureCertificate` on a
|
|
241
|
+
route that needs no sign-in (ARBI uses `/verify/:reference`), inside a `DocumentToolsProvider` with
|
|
242
|
+
an unauthenticated client: it is the page the signature on a signed PDF links to.
|
|
243
|
+
|
|
160
244
|
## Editorial site parts
|
|
161
245
|
|
|
162
246
|
`@arbidocs/blocks/site` (and the root) carry the layout parts for static marketing pages:
|