docblocks-react-ui 0.6.6 → 0.7.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 +43 -0
- package/README.md +53 -3
- package/dist/{Editor-D_TogV4X.mjs → Editor-BM6-5TFS.mjs} +3716 -3332
- package/dist/{constants-OOBlKSTr.mjs → constants-D8PSgkwi.mjs} +6 -6
- package/dist/{index-CeuUfoao.d.mts → index-B72m5FmT.d.mts} +47 -2
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +2 -2
- package/dist/mermaid/index.mjs +2 -2
- package/dist/pdf/index.d.mts +1 -1
- package/dist/pdf/index.mjs +2 -2
- package/dist/styles.css +25 -18
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# docblocks-react-ui
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2b1fdb0: The blob store's meta-only stand: the two optional `BlobStore` members
|
|
8
|
+
`getMeta(fileId)` (the metadata WITHOUT the bytes — the cheap head stand)
|
|
9
|
+
and `downloadUrl(fileId)` (the direct download URL). With them, the
|
|
10
|
+
built-in `file` / `image` blocks resolve the metadata first and fetch the
|
|
11
|
+
bytes only for a MIME they render (the PDF preview / the `<img>`); any
|
|
12
|
+
other MIME stands the download card without fetching the bytes (no `get`
|
|
13
|
+
call, no object URL — the download's href stands the consumer's
|
|
14
|
+
`downloadUrl`). Without `getMeta` (or without `downloadUrl`) the blocks
|
|
15
|
+
keep the legacy stand exactly (the bytes over `get`, the object URL's
|
|
16
|
+
href) — existing consumers and `createMemoryBlobStore` are unchanged.
|
|
17
|
+
- bad9923: The mention chip re-stands as plain text: the kind's inline icon (the
|
|
18
|
+
`user`'s person, the `doc`'s exit arrow) over the semibold, underlined
|
|
19
|
+
label — the rounded pill stands removed, so a mention row keeps its
|
|
20
|
+
plain-text height. The chip gains the `data-mention-id` attribute (the
|
|
21
|
+
target id for the consumer's live-label / "removed" stands), and the
|
|
22
|
+
`--docblocks-mention-background` token stands removed (the chip no longer
|
|
23
|
+
paints a background).
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- 6ad393f: Filter popover fixes: the segment selector's active button no longer
|
|
28
|
+
restyles its label over the pill's fill on hover (the ghost button's
|
|
29
|
+
hover restyle washed the label to an unreadable color over the primary
|
|
30
|
+
fill). The filter popover's condition/group add rows and the clear/apply
|
|
31
|
+
footer keep a clear break (the popover's own 10px rhythm over both sides
|
|
32
|
+
of the separator).
|
|
33
|
+
- 7b444ee: The new optional `mentionInteractions` provider prop
|
|
34
|
+
(`{ renderCard, onClick? }`) stands the mention chip's interactions
|
|
35
|
+
(independent of the `mentionProvider` — it works for any mention in the
|
|
36
|
+
document): the hover card — the consumer's content and design over the
|
|
37
|
+
package's portaled host (the position and the lifecycle are the
|
|
38
|
+
package's: the hover's open delay, the exit / Escape / scroll's close, and
|
|
39
|
+
the anchor chip's removal's close) — and the chip's click delivery (the
|
|
40
|
+
native `MouseEvent` to the consumer's `onClick`; the package opens nothing
|
|
41
|
+
on the click and stands no default behavior). The target stands the
|
|
42
|
+
document's `mention` mark (the core's `MentionMark` — re-exported for the
|
|
43
|
+
consumer's convenience). Without the prop the chip stands as before (no
|
|
44
|
+
card, the click is the browser's stand).
|
|
45
|
+
|
|
3
46
|
## 0.6.6
|
|
4
47
|
|
|
5
48
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -104,6 +104,7 @@ mention catalog). The full props list:
|
|
|
104
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. |
|
|
105
105
|
| `pdfPreview?` | A first-page preview component for PDF file blocks (and legacy PDF image blocks). |
|
|
106
106
|
| `mentionProvider?` | The `@` mention picker's search catalog (see below). |
|
|
107
|
+
| `mentionInteractions?` | The mention chip's hover card + the click's delivery (see below). Without the prop the chip stands inert (no card, the click is the browser's stand). |
|
|
107
108
|
| `rootBlockId?` | Render the entry list of this block instead of the document root (the subtree view). Must not change after mount. |
|
|
108
109
|
| `commandPalettePlaceholder?` | The empty-block hint override; the default is localized (en/ru). |
|
|
109
110
|
| `accessLevel?` | The consumer's user access level (default `editor`): `viewer` forces the `published` mode (the current state is never rendered to a reader). |
|
|
@@ -332,12 +333,25 @@ interface BlobStore {
|
|
|
332
333
|
rename(fileId: string, name: string): Promise<BlobMeta>;
|
|
333
334
|
subscribe(fileId: string, onChange: () => void): () => void;
|
|
334
335
|
remove?(fileId: string): Promise<void>;
|
|
336
|
+
getMeta?(fileId: string): Promise<BlobMeta>;
|
|
337
|
+
downloadUrl?(fileId: string): string;
|
|
335
338
|
}
|
|
336
339
|
```
|
|
337
340
|
|
|
338
341
|
- `get` rejects an unknown id; the block renders a placeholder while loading
|
|
339
342
|
or when the id is unavailable. The library creates an object URL for the
|
|
340
343
|
returned blob and revokes it on replacement or unmount.
|
|
344
|
+
- **The meta-only stand (opt-in):** with the optional `getMeta` member the
|
|
345
|
+
blocks resolve the metadata first (a cheap head stand, no body transfer).
|
|
346
|
+
A MIME the block renders — `application/pdf` for the `file` block, the
|
|
347
|
+
`image/*` and `application/pdf` payloads for the `image` block — still
|
|
348
|
+
resolves the bytes over `get` (the pdf preview / the `<img>` stand
|
|
349
|
+
unchanged); any other MIME stands the download card WITHOUT fetching the
|
|
350
|
+
bytes (no `get` call, no object URL), the download's href standing the
|
|
351
|
+
consumer's `downloadUrl(fileId)`. Without `getMeta` — or without
|
|
352
|
+
`downloadUrl` — the blocks keep the legacy stand (the bytes over `get`,
|
|
353
|
+
the object URL's href). Both members are optional: existing consumers and
|
|
354
|
+
`createMemoryBlobStore` stand exactly the legacy behavior.
|
|
341
355
|
- The file picker accepts arbitrary files. New `image/*` uploads create an
|
|
342
356
|
`image` block; other MIME types, including `application/pdf`, create a
|
|
343
357
|
`file` block. PDF files render through `pdfPreview` or the sandboxed native
|
|
@@ -566,9 +580,45 @@ const mentionProvider = {
|
|
|
566
580
|
A pick replaces the `@query` phrase with the label and stands the `mention`
|
|
567
581
|
mark (the `kind` `"user"` or `"doc"`, the `id`, and the `label` snapshot) in
|
|
568
582
|
one transaction — one undo step. The mention renders as an atomic,
|
|
569
|
-
non-editable chip
|
|
570
|
-
|
|
571
|
-
|
|
583
|
+
non-editable chip: the kind's inline icon (the `user`'s person, the `doc`'s
|
|
584
|
+
exit arrow) over the semibold, underlined label — an inline run of the text
|
|
585
|
+
line, no pill of its own. The chip carries the target id
|
|
586
|
+
(`data-mention-kind` + `data-mention-id`), so the consumer can stand a live
|
|
587
|
+
label or a "removed" state by id (the `label` stays the stable display
|
|
588
|
+
snapshot — a renamed / removed target does not change the document).
|
|
589
|
+
Copying a mention stands the `@label` plain text. Without the prop the `@`
|
|
590
|
+
is plain text (no picker). The mark is non-exclusive (it composes with the
|
|
591
|
+
other marks).
|
|
592
|
+
|
|
593
|
+
The optional `mentionInteractions` prop stands the chip's hover card and the
|
|
594
|
+
chip's click (independent of the `mentionProvider` — the card stands for any
|
|
595
|
+
mention in the document). The package stands the card's position and the
|
|
596
|
+
lifecycle only (the portaled host anchored at the chip, the hover's open
|
|
597
|
+
delay, the exit / Escape / scroll's close, and the anchor chip's removal's
|
|
598
|
+
close — a doc change that re-renders the chip closes the card); the design
|
|
599
|
+
and the data are the consumer's:
|
|
600
|
+
|
|
601
|
+
```ts
|
|
602
|
+
const mentionInteractions: MentionInteractions = {
|
|
603
|
+
// The hover card's content (the consumer's design + data); null stands no
|
|
604
|
+
// card for this target (e.g. the removed target's stand).
|
|
605
|
+
renderCard: (mention) => <MyMiniCard mention={mention} />,
|
|
606
|
+
// The chip's click: the consumer decides what opens (the navigation, the
|
|
607
|
+
// modal). The native event — event.preventDefault() keeps the caret in
|
|
608
|
+
// place. The package opens nothing on the click.
|
|
609
|
+
onClick: (mention, event) => {
|
|
610
|
+
event.preventDefault();
|
|
611
|
+
openUserOrDoc(mention.kind, mention.id);
|
|
612
|
+
},
|
|
613
|
+
};
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
The target stands the document's `mention` mark (the core's `MentionMark`
|
|
617
|
+
— the `kind`, the stable `id`, and the `label` snapshot): resolve the
|
|
618
|
+
current data over the `id` (the catalog, the URL) and stand the live label
|
|
619
|
+
or the removed state yourself — the `label` is the display snapshot. The
|
|
620
|
+
value is read per render into the provider context: pass a stable reference.
|
|
621
|
+
A nested provider that supplies none inherits the enclosing one.
|
|
572
622
|
|
|
573
623
|
### Canvas
|
|
574
624
|
|