docblocks-react-ui 0.4.7 → 0.6.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.
- package/CHANGELOG.md +36 -0
- package/README.md +67 -33
- package/dist/{Editor-CTSlILEm.mjs → Editor-BavCl07r.mjs} +13639 -13005
- package/dist/{constants-BaAj3jDA.mjs → constants-2VXoyPmd.mjs} +76 -43
- package/dist/{index-CZEO5s2i.d.mts → index-DyPFy2m5.d.mts} +44 -75
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +3 -3
- package/dist/mermaid/index.mjs +2 -2
- package/dist/pdf/index.d.mts +2 -2
- package/dist/pdf/index.mjs +253 -60
- package/dist/styles.css +61 -6
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# docblocks-react-ui
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8b0f589: Add a zoom bar to the PDF preview's fullscreen mode: a separate pill to the left of the page controls with the zoom in/out buttons (over the fitted scale, 25%-400% bounds), the scale indicator, the fit-width and the fit-height buttons (the page's width/height fills the viewport's width/height, the overflow scrolls). The fullscreen mode pages with the left/right arrow keys, locks the body's scroll while open (the wheel over the overlay no longer scrolls the page behind), and stands a fixed-width page indicator (a digit count change no longer shifts the page buttons). The preview chrome stands no text selection (the page indicator and the controls are not document content), so selecting the page numbers can no longer flag the block or pull up the format toolbar.
|
|
8
|
+
- 7f26c1a: Localize the empty-block command palette placeholder for Russian locales while preserving consumer overrides.
|
|
9
|
+
- 8f6a3d6: - Add first-class file blocks with consumer-owned file ids, live rename subscriptions, reader downloads, and PDF previews.
|
|
10
|
+
- Replace URL-based blob resolution with Blob+metadata stores and remove the legacy `blobResolver` prop.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 16e10af: Fix attachment insertion and deletion gestures: replace phrase-only slash blocks, keep removal and the trailing paragraph in one undo step, and seat the caret on a surviving text block.
|
|
15
|
+
- Updated dependencies [8f6a3d6]
|
|
16
|
+
- docblocks-core@0.3.0
|
|
17
|
+
|
|
18
|
+
## 0.5.0
|
|
19
|
+
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- 3d0b793: Add a database column manager for restoring hidden columns and reordering the full column list by mouse or keyboard while preserving visible column widths. Keep a newly inserted row visible with a themed orange outline when it does not match the active filter until editing loses focus.
|
|
23
|
+
- ca80cd1: Rebuild the database filter menu over the library's field style: the
|
|
24
|
+
condition's field / operator / value stand a single line over styled
|
|
25
|
+
controls in a widened popover, the conditions and the nested group cards
|
|
26
|
+
are bound by the group's left connector line, the AND/OR logic's labels
|
|
27
|
+
stand the UI's locale and the active pill takes the prominent `primary`
|
|
28
|
+
token's fill (the white's stand over the neutral's dark theme), and the
|
|
29
|
+
footer's apply/clear stand over a separator line. The grid toolbar's undo/redo/columns/filter buttons
|
|
30
|
+
stand the standard toolbar height and rounding, and the standalone
|
|
31
|
+
`DatabaseTable` renders no table name (the consumer's own visual element
|
|
32
|
+
stands the name — the document block's grid keeps the live name and the
|
|
33
|
+
rename).
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- 87a2cc9: Preserve thin cell boundaries in native table drag previews with or without a cell background, and keep the dragged handle aligned with the moving row or column by removing its positional animation lag.
|
|
38
|
+
|
|
3
39
|
## 0.4.7
|
|
4
40
|
|
|
5
41
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -86,7 +86,7 @@ a bare `tsc`-only setup needs a one-line `declare module "*.css"` shim.
|
|
|
86
86
|
Everything the editor needs from the consumer is injected as an
|
|
87
87
|
`EditorProvider` prop; every prop except `doc` is optional. The only
|
|
88
88
|
built-in default is the blob store (a shared in-memory stand — the
|
|
89
|
-
uploads
|
|
89
|
+
uploads stay in memory for the JS session, cleared on reload); the
|
|
90
90
|
other props degrade gracefully over their absence (the external-form
|
|
91
91
|
database block stands the not-connected placeholder and the `/database`
|
|
92
92
|
slash command is hidden without a bridge; the `sync-embed` block stands
|
|
@@ -99,14 +99,13 @@ mention catalog). The full props list:
|
|
|
99
99
|
| `provider?` | A core `SyncProvider` for the wire + presence. Without it the editor is a single-client document (local edits stand, nothing syncs). |
|
|
100
100
|
| `blockRenderers?` | Per-type renderer overrides (see below). |
|
|
101
101
|
| `blobStore?` | The blob bridge for image / pdf / file blocks (see below). |
|
|
102
|
-
| `blobResolver?` | Legacy view-only resolver (key → src string). Wrapped as a store: no upload, subtype `image`. Prefer `blobStore`. |
|
|
103
102
|
| `databaseBridge?` | The table operations behind external-form database blocks (see below). |
|
|
104
103
|
| `syncEmbedResolver?` | `(ref) => Doc \| null` — resolves a `sync-embed` block's ref to the master doc (see below). |
|
|
105
104
|
| `embedSandbox?` | `(src) => string \| null` — the embed iframe's `sandbox` policy. The default grants the same-origin (the embedded app's own storage / cookies stand, so the real apps boot); `null` stands no sandbox (a fully trusted embed). The opaque-origin restriction stands over this policy. |
|
|
106
|
-
| `pdfPreview?` | A first-page preview component for
|
|
105
|
+
| `pdfPreview?` | A first-page preview component for PDF file blocks (and legacy PDF image blocks). |
|
|
107
106
|
| `mentionProvider?` | The `@` mention picker's search catalog (see below). |
|
|
108
107
|
| `rootBlockId?` | Render the entry list of this block instead of the document root (the subtree view). Must not change after mount. |
|
|
109
|
-
| `commandPalettePlaceholder?` | The empty-block hint
|
|
108
|
+
| `commandPalettePlaceholder?` | The empty-block hint override; the default is localized (en/ru). |
|
|
110
109
|
| `accessLevel?` | The consumer's user access level (default `editor`): `viewer` forces the `published` mode (the current state is never rendered to a reader). |
|
|
111
110
|
| `mode?` | The document mode (default `edit`): `view` is a read-only live document; `published` renders the `publishedDoc` snapshot read-only. |
|
|
112
111
|
| `publishedDoc?` | The published snapshot (a hydrated core `Doc`; must not change after mount — remount over `key` for a new snapshot). The consumer owns the publish action and the snapshot storage. |
|
|
@@ -316,33 +315,45 @@ anonymous plaintext selection over the room — the 0.2.0 behavior).
|
|
|
316
315
|
|
|
317
316
|
### Blobs
|
|
318
317
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
318
|
+
File-backed blocks hold only consumer-owned ids: `file.attrs.fileId` for
|
|
319
|
+
attachments and PDFs, and `image.attrs.src` for inline images. Bytes, names,
|
|
320
|
+
and MIME types never enter the document. `BlobStore` is the only bridge
|
|
321
|
+
between those ids and the stored objects:
|
|
322
322
|
|
|
323
323
|
```ts
|
|
324
|
+
interface BlobMeta {
|
|
325
|
+
name: string;
|
|
326
|
+
mimeType: string;
|
|
327
|
+
}
|
|
328
|
+
|
|
324
329
|
interface BlobStore {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
remove?(key: string): Promise<void>; // optional gc
|
|
330
|
+
get(fileId: string): Promise<{ blob: Blob; meta: BlobMeta }>;
|
|
331
|
+
upload(file: File): Promise<string>;
|
|
332
|
+
rename(fileId: string, name: string): Promise<BlobMeta>;
|
|
333
|
+
subscribe(fileId: string, onChange: () => void): () => void;
|
|
334
|
+
remove?(fileId: string): Promise<void>;
|
|
331
335
|
}
|
|
332
336
|
```
|
|
333
337
|
|
|
334
|
-
- `
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
338
|
+
- `get` rejects an unknown id; the block renders a placeholder while loading
|
|
339
|
+
or when the id is unavailable. The library creates an object URL for the
|
|
340
|
+
returned blob and revokes it on replacement or unmount.
|
|
341
|
+
- The file picker accepts arbitrary files. New `image/*` uploads create an
|
|
342
|
+
`image` block; other MIME types, including `application/pdf`, create a
|
|
343
|
+
`file` block. PDF files render through `pdfPreview` or the sandboxed native
|
|
344
|
+
iframe; other files render a card with file and download icons.
|
|
345
|
+
- `meta.name` is the authoritative display and suggested download name.
|
|
346
|
+
Editors rename through `rename(fileId, name)`; the document JSON does not
|
|
347
|
+
change and document undo/redo does not revert storage renames. The store
|
|
348
|
+
notifies `subscribe` listeners after rename or replacement, so every open
|
|
349
|
+
view reloads the current blob and metadata. A rejection keeps the previous
|
|
350
|
+
name and displays an inline error. Read-only modes hide rename and keep
|
|
351
|
+
download available.
|
|
352
|
+
- Consumers can also update S3 `Content-Disposition` in `rename` when direct
|
|
353
|
+
storage URLs outside the library must carry the same filename.
|
|
354
|
+
- Without `blobStore`, the editor uses a shared in-memory store, cleared on
|
|
355
|
+
page reload. `createMemoryBlobStore` is exported for consumers that want the
|
|
356
|
+
same behavior in their own store composition.
|
|
346
357
|
|
|
347
358
|
### Database
|
|
348
359
|
|
|
@@ -395,6 +406,26 @@ package root: `BridgeError` (the structured error type) with
|
|
|
395
406
|
`isDatabaseBridge`, and `useDatabaseTable(bridge, tableId, filter?)` — the
|
|
396
407
|
grid controller for a consumer-owned grid over the bridge.
|
|
397
408
|
|
|
409
|
+
The grid's **Columns** control lists every column, restores hidden columns,
|
|
410
|
+
and reorders them by dragging their grips or pressing ArrowUp/ArrowDown on a
|
|
411
|
+
focused grip. Header drag and the popover share one full column order, and
|
|
412
|
+
visible column widths follow the moved column.
|
|
413
|
+
|
|
414
|
+
The grid's **Filter** control edits a recursive and/or condition tree: one
|
|
415
|
+
row per condition (the field / the operator / the value over the column's
|
|
416
|
+
annotation, a single line), the nested groups over bordered cards, and the
|
|
417
|
+
conditions and the groups bound by the group's left connector line. The
|
|
418
|
+
logic's labels stand the UI's locale (en/ru), the active pill over the
|
|
419
|
+
prominent `primary` fill. `Apply` commits the draft as
|
|
420
|
+
the view's `filter` attr (the block's write stand); `Clear` resets it.
|
|
421
|
+
|
|
422
|
+
When an inserted row does not match the active filter, the grid keeps it
|
|
423
|
+
visible with an orange outline while its initial edit session has focus. The
|
|
424
|
+
row leaves the filtered view when focus moves elsewhere; the bridge data is
|
|
425
|
+
unchanged. `useDatabaseTable` exposes this transient row as `pendingRow` and
|
|
426
|
+
`dismissPendingRow(rowId?)` for consumer-owned grids implementing the same
|
|
427
|
+
interaction.
|
|
428
|
+
|
|
398
429
|
### Standalone database table
|
|
399
430
|
|
|
400
431
|
The database's UI stands outside any document as well — the
|
|
@@ -431,7 +462,10 @@ className? })` —
|
|
|
431
462
|
the optional `view` prop at mount); `onViewChange(patch)` receives one
|
|
432
463
|
patch per change for the consumer's persistence (the controlled mode
|
|
433
464
|
stands absent — the state is never external). `readOnly` gates the
|
|
434
|
-
editing's paths (the read-only block's parity). The
|
|
465
|
+
editing's paths (the read-only block's parity). The standalone's grid
|
|
466
|
+
stands no table-name display — the consumer's own visual element (the
|
|
467
|
+
section's list / the heading) stands the name; the document block's
|
|
468
|
+
grid keeps the live name + the rename over it. The sizing's stand is
|
|
435
469
|
the consumer's: the grid stands the root's width (`w-full`), and the
|
|
436
470
|
`className` over the root (the component's own classes stand merged
|
|
437
471
|
over it) — a height-constrained root stands the grid's inner scroll
|
|
@@ -495,8 +529,8 @@ const blockRenderers: BlockRendererMap = {
|
|
|
495
529
|
|
|
496
530
|
### PDF preview
|
|
497
531
|
|
|
498
|
-
`pdfPreview` is a component that renders a
|
|
499
|
-
|
|
532
|
+
`pdfPreview` is a component that renders a PDF file block's bytes as a
|
|
533
|
+
client-side first-page preview. The `./pdf` subpath
|
|
500
534
|
provides one over `pdfjs-dist` (a required peer):
|
|
501
535
|
|
|
502
536
|
```tsx
|
|
@@ -507,11 +541,11 @@ import { PdfFirstPage } from "docblocks-react-ui/pdf";
|
|
|
507
541
|
</EditorProvider>;
|
|
508
542
|
```
|
|
509
543
|
|
|
510
|
-
The renderer receives `{ id, url, name }
|
|
511
|
-
|
|
512
|
-
`data-block-id={id}
|
|
513
|
-
|
|
514
|
-
native iframe viewer; a failed preview render falls back to it, so the
|
|
544
|
+
The renderer receives `{ id, blockType, url, name }`: the block id, `file` for
|
|
545
|
+
new PDF blocks or `image` for legacy ones, the library-owned object URL, and
|
|
546
|
+
the store's authoritative name. It stamps `data-block-id={id}` and
|
|
547
|
+
`data-block-type={blockType}` on its root. Without the prop a PDF block stands
|
|
548
|
+
the native iframe viewer; a failed preview render falls back to it, so the
|
|
515
549
|
document always stays viewable.
|
|
516
550
|
|
|
517
551
|
### Mentions
|