docblocks-react-ui 0.22.0 → 0.24.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 +34 -8
- package/dist/{Editor-WNvtSeS1.mjs → Editor-CDZqsAHh.mjs} +440 -203
- package/dist/{index-BV-kKwCB.d.mts → index-CE8wKsue.d.mts} +12 -7
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +1 -1
- package/dist/mermaid/index.mjs +1 -1
- package/dist/pdf/index.d.mts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# docblocks-react-ui
|
|
2
2
|
|
|
3
|
+
## 0.24.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- bcb2bb4: An HTML table's `colspan` / `rowspan` survives the import: `importDocument`
|
|
8
|
+
with `kind: "html"` and the rich `text/html` paste land the merged regions as
|
|
9
|
+
the data model's own merged cells — the anchor cell carries the spans, the
|
|
10
|
+
cells a region covers stand absent from their rows, and the grid matches the
|
|
11
|
+
source table. The cells are placed by the browser's table model (a cell takes
|
|
12
|
+
the first free column of its row, a row span reserves the coordinates below),
|
|
13
|
+
so a row shifted by a span above keeps its columns.
|
|
14
|
+
|
|
15
|
+
A malformed span degrades to the span the grid fits — a non-integer or a value
|
|
16
|
+
below 1 stands 1, a span running onto a covered coordinate or past the last
|
|
17
|
+
row is clamped — so the parse never throws on arbitrary markup and the same
|
|
18
|
+
payload always imports the same document. The markdown kind carries no merged
|
|
19
|
+
cells (GFM cannot express them).
|
|
20
|
+
|
|
21
|
+
## 0.23.0
|
|
22
|
+
|
|
23
|
+
### Minor Changes
|
|
24
|
+
|
|
25
|
+
- bb8b0fc: An image renders straight from the store's `downloadUrl` when the store
|
|
26
|
+
supplies both optional members: the `image` block's `<img>` src is
|
|
27
|
+
`downloadUrl(fileId)` — the browser's own cacheable subrequest — instead of
|
|
28
|
+
the bytes fetched over `get` into an object URL. A response fetched into a
|
|
29
|
+
blob URL never reuses the native response cache on WebKit, so a page reload
|
|
30
|
+
in Safari re-downloaded every image regardless of the backend's
|
|
31
|
+
`Cache-Control: immutable`.
|
|
32
|
+
|
|
33
|
+
The document attributes' cover stands the same contract: the banner, the
|
|
34
|
+
row's thumbnail and the preset cells render the store's URL, and the
|
|
35
|
+
intrinsic-dimension probe plus the frame's tint read that same URL instead
|
|
36
|
+
of decoding the blob (a cross-origin URL without CORS taints the tint's
|
|
37
|
+
canvas — the tint falls back to the fetched bytes' same-origin object URL).
|
|
38
|
+
|
|
39
|
+
`getMeta` still decides the MIME and reserves the placeholder's aspect
|
|
40
|
+
ratio; the consumer's URL must serve the payload inline (a
|
|
41
|
+
`Content-Disposition: attachment` response suits the download card only).
|
|
42
|
+
PDF payloads (the preview and the native iframe), a store without `getMeta`
|
|
43
|
+
(the MIME is unknown before the bytes) and an executable-scheme URL keep
|
|
44
|
+
the bytes' path; without `downloadUrl` nothing changes.
|
|
45
|
+
|
|
3
46
|
## 0.22.0
|
|
4
47
|
|
|
5
48
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -296,6 +296,13 @@ attach(doc, provider);
|
|
|
296
296
|
|
|
297
297
|
- `kind: "markdown" | "html"` — the paste parsers' shared materialization
|
|
298
298
|
(the same typed block / table / runs writes the paste pipeline uses);
|
|
299
|
+
- an HTML table's `colspan` / `rowspan` lands as the data model's merged
|
|
300
|
+
regions — the anchor cell carries the spans, the cells a region covers
|
|
301
|
+
stand absent from their rows. A malformed span (a non-integer, below 1,
|
|
302
|
+
an overlap with another region, a span past the last row) degrades to the
|
|
303
|
+
span the grid fits; the parse never throws and the same payload always
|
|
304
|
+
imports the same document. The markdown path carries no merged cells (GFM
|
|
305
|
+
cannot express them);
|
|
299
306
|
- an empty or whitespace-only payload is a no-op (no transaction);
|
|
300
307
|
- a non-fresh document (the root has children) throws the typed
|
|
301
308
|
`ImportDocumentError` — the import fills the root, it never appends;
|
|
@@ -470,14 +477,31 @@ interface BlobStore {
|
|
|
470
477
|
- **The meta-only stand (opt-in):** with the optional `getMeta` member the
|
|
471
478
|
blocks resolve the metadata first (a cheap head stand, no body transfer).
|
|
472
479
|
A MIME the block renders — `application/pdf` for the `file` block, the
|
|
473
|
-
`image/*` and `application/pdf` payloads for the `image` block —
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
bytes (no `get` call, no
|
|
477
|
-
|
|
478
|
-
`downloadUrl` —
|
|
479
|
-
the
|
|
480
|
+
`image/*` and `application/pdf` payloads for the `image` block — resolves
|
|
481
|
+
the bytes over `get` (the pdf preview / the `<img>` stand), except for an
|
|
482
|
+
image the store's `downloadUrl` serves (the next bullet); any other MIME
|
|
483
|
+
stands the download card WITHOUT fetching the bytes (no `get` call, no
|
|
484
|
+
object URL), the download's href standing the consumer's
|
|
485
|
+
`downloadUrl(fileId)`. Without `getMeta` — or without `downloadUrl` — the
|
|
486
|
+
blocks keep the legacy stand (the bytes over `get`, the object URL's
|
|
487
|
+
href). Both members are optional: existing consumers and
|
|
480
488
|
`createMemoryBlobStore` stand exactly the legacy behavior.
|
|
489
|
+
- **The direct image URL:** an `image/*` payload over a store that supplies
|
|
490
|
+
both `getMeta` and `downloadUrl` renders `<img src={downloadUrl(fileId)}>`
|
|
491
|
+
— the browser's own subrequest, cached natively. The library neither
|
|
492
|
+
fetches the bytes nor creates an object URL: a `fetch`-resolved blob URL
|
|
493
|
+
never reuses the native cache on WebKit, so every page reload
|
|
494
|
+
re-downloaded the images. `getMeta` still decides the MIME and reserves
|
|
495
|
+
the placeholder's aspect ratio, and `downloadUrl` serves the payload
|
|
496
|
+
inline (a `Content-Disposition: attachment` response suits the download
|
|
497
|
+
card only). PDF payloads stay on the bytes' path (the preview and the
|
|
498
|
+
iframe read the bytes); without `getMeta` — the MIME is unknown before
|
|
499
|
+
the bytes — or over an executable-scheme URL, an image keeps that path as
|
|
500
|
+
well. The document attributes' cover stands the same contract: the
|
|
501
|
+
banner, the row's thumbnail and the preset cells render the store's URL,
|
|
502
|
+
and the intrinsic-dimension probe plus the frame's tint read that same
|
|
503
|
+
URL (a cross-origin URL without CORS taints the tint's canvas — the tint
|
|
504
|
+
falls back to the fetched bytes' same-origin object URL).
|
|
481
505
|
- **The lazy resolution (the default):** the metadata's head lookup runs at
|
|
482
506
|
mount (the placeholder reserves the aspect ratio from `width`/`height`),
|
|
483
507
|
and the bytes resolve only once the block enters the preload band — the
|
|
@@ -905,7 +929,9 @@ value actually changes (the store's reference-stability contract):
|
|
|
905
929
|
- `useCoverAverageColor()` — the stored cover's alpha-weighted average
|
|
906
930
|
color (the `rgb(...)` string or `null` over the absent / the
|
|
907
931
|
undecodable's stand) — the frame's tint's data and the consumer's
|
|
908
|
-
surroundings' glow's source.
|
|
932
|
+
surroundings' glow's source. The read stands over the cover's resolved
|
|
933
|
+
URL (the store's `downloadUrl` when supplied, the object URL otherwise);
|
|
934
|
+
a cross-origin URL without CORS falls back to the fetched bytes.
|
|
909
935
|
- `useDatabaseTable(bridge, tableId, filter?)` — the external database
|
|
910
936
|
block's grid controller (a consumer-owned grid over the bridge).
|
|
911
937
|
|
|
@@ -12343,25 +12343,29 @@ function useInView(options = {}) {
|
|
|
12343
12343
|
* on (a document of images resolves its first screen only).
|
|
12344
12344
|
*
|
|
12345
12345
|
* With a `getMeta` member the non-renderable MIME (the predicate) stands
|
|
12346
|
-
* the meta-only view when the store supplies a `downloadUrl`;
|
|
12347
|
-
*
|
|
12348
|
-
*
|
|
12349
|
-
*
|
|
12350
|
-
*
|
|
12351
|
-
*
|
|
12352
|
-
*
|
|
12346
|
+
* the meta-only view when the store supplies a `downloadUrl`; a renderable
|
|
12347
|
+
* MIME the `rendersFromUrl` predicate claims stands the direct-URL view (the
|
|
12348
|
+
* image's own `<img>` subrequest, no bytes in the JS heap) over the same
|
|
12349
|
+
* store member; the remaining renderable MIME (and the absent
|
|
12350
|
+
* `downloadUrl`) resolves the bytes over `get` as before. Without `getMeta`
|
|
12351
|
+
* the resolution stands the legacy path's phases: no metadata before the
|
|
12352
|
+
* bytes, the bytes over `get` once the block is in view. A store change
|
|
12353
|
+
* re-resolves over the current band, and a view that already resolved never
|
|
12354
|
+
* falls back to the placeholder outside it. An empty `fileId` stands the
|
|
12355
|
+
* missing stand without a store read (an absent cover's row).
|
|
12353
12356
|
*/
|
|
12354
12357
|
function useBlobFile(fileId, rendersBytes, options = {}) {
|
|
12355
12358
|
const { blobStore, scrollContainer } = useEditorContext();
|
|
12356
12359
|
const getMeta = blobStore.getMeta;
|
|
12360
|
+
const rendersFromUrl = options.rendersFromUrl;
|
|
12357
12361
|
const [ref, setRef] = useState(null);
|
|
12358
|
-
const [
|
|
12362
|
+
const [urlView, setUrlView] = useState(null);
|
|
12359
12363
|
/** The head's metadata (the loading stand's aspect-ratio input). */
|
|
12360
12364
|
const [headMeta, setHeadMeta] = useState(null);
|
|
12361
12365
|
/** The resolution's rejection (the missing stand) — a resolve clears it. */
|
|
12362
12366
|
const [failed, setFailed] = useState(false);
|
|
12363
12367
|
const [view, setView] = useState(null);
|
|
12364
|
-
const headSettled = options.eager === true || blobStore.getMeta === void 0 || headMeta !== null ||
|
|
12368
|
+
const headSettled = options.eager === true || blobStore.getMeta === void 0 || headMeta !== null || urlView !== null || failed;
|
|
12365
12369
|
const { ref: observeRef, inView } = useInView({
|
|
12366
12370
|
disabled: options.eager === true,
|
|
12367
12371
|
ready: headSettled,
|
|
@@ -12377,19 +12381,24 @@ function useBlobFile(fileId, rendersBytes, options = {}) {
|
|
|
12377
12381
|
let alive = true;
|
|
12378
12382
|
let sequence = 0;
|
|
12379
12383
|
setRef(null);
|
|
12380
|
-
|
|
12384
|
+
setUrlView(null);
|
|
12381
12385
|
setHeadMeta(null);
|
|
12382
12386
|
setFailed(false);
|
|
12383
12387
|
loadedRef.current = false;
|
|
12388
|
+
if (fileId === "") {
|
|
12389
|
+
setFailed(true);
|
|
12390
|
+
return;
|
|
12391
|
+
}
|
|
12384
12392
|
/** The head's resolved stand over this resolution's lifetime: the
|
|
12385
12393
|
* band's entry reuses it (the store's change re-reads it fresh). */
|
|
12386
12394
|
let head = null;
|
|
12387
12395
|
/** The head's in-flight request: a non-fresh load joins it instead of
|
|
12388
12396
|
* issuing a second lookup while one is pending. */
|
|
12389
12397
|
let headRequest = null;
|
|
12390
|
-
/** The head decided
|
|
12391
|
-
let
|
|
12398
|
+
/** The head decided a store-URL stand (no bytes stand over any band). */
|
|
12399
|
+
let urlOnly = false;
|
|
12392
12400
|
const load = async (freshHead) => {
|
|
12401
|
+
if (fileId === "") return;
|
|
12393
12402
|
const request = ++sequence;
|
|
12394
12403
|
const current = () => alive && request === sequence;
|
|
12395
12404
|
try {
|
|
@@ -12402,29 +12411,43 @@ function useBlobFile(fileId, rendersBytes, options = {}) {
|
|
|
12402
12411
|
head = meta;
|
|
12403
12412
|
setHeadMeta(meta);
|
|
12404
12413
|
const downloadUrl = blobStore.downloadUrl;
|
|
12405
|
-
|
|
12406
|
-
|
|
12414
|
+
const url = downloadUrl === void 0 ? null : downloadUrl(fileId);
|
|
12415
|
+
urlOnly = false;
|
|
12416
|
+
if (url !== null && rendersBytes !== void 0 && !rendersBytes(meta.mimeType)) {
|
|
12417
|
+
urlOnly = true;
|
|
12418
|
+
setRef(null);
|
|
12419
|
+
setUrlView({
|
|
12420
|
+
status: "ready-meta",
|
|
12421
|
+
meta,
|
|
12422
|
+
url
|
|
12423
|
+
});
|
|
12424
|
+
setFailed(false);
|
|
12425
|
+
return;
|
|
12426
|
+
}
|
|
12427
|
+
if (url !== null && rendersFromUrl !== void 0 && rendersFromUrl(meta.mimeType) && isSafeDownloadHref(url)) {
|
|
12428
|
+
urlOnly = true;
|
|
12407
12429
|
setRef(null);
|
|
12408
|
-
|
|
12430
|
+
setUrlView({
|
|
12431
|
+
status: "ready-url",
|
|
12409
12432
|
meta,
|
|
12410
|
-
url
|
|
12433
|
+
url
|
|
12411
12434
|
});
|
|
12412
12435
|
setFailed(false);
|
|
12413
12436
|
return;
|
|
12414
12437
|
}
|
|
12415
|
-
} else if (
|
|
12438
|
+
} else if (urlOnly) return;
|
|
12416
12439
|
}
|
|
12417
12440
|
if (!inViewRef.current) return;
|
|
12418
12441
|
const next = await blobStore.get(fileId);
|
|
12419
12442
|
if (!current()) return;
|
|
12420
12443
|
loadedRef.current = true;
|
|
12421
12444
|
setRef(next);
|
|
12422
|
-
|
|
12445
|
+
setUrlView(null);
|
|
12423
12446
|
setFailed(false);
|
|
12424
12447
|
} catch {
|
|
12425
12448
|
if (!current()) return;
|
|
12426
12449
|
setRef(null);
|
|
12427
|
-
|
|
12450
|
+
setUrlView(null);
|
|
12428
12451
|
setFailed(true);
|
|
12429
12452
|
}
|
|
12430
12453
|
};
|
|
@@ -12442,7 +12465,8 @@ function useBlobFile(fileId, rendersBytes, options = {}) {
|
|
|
12442
12465
|
}, [
|
|
12443
12466
|
blobStore,
|
|
12444
12467
|
fileId,
|
|
12445
|
-
rendersBytes
|
|
12468
|
+
rendersBytes,
|
|
12469
|
+
rendersFromUrl
|
|
12446
12470
|
]);
|
|
12447
12471
|
useEffect(() => {
|
|
12448
12472
|
inViewRef.current = inView;
|
|
@@ -12472,11 +12496,8 @@ function useBlobFile(fileId, rendersBytes, options = {}) {
|
|
|
12472
12496
|
},
|
|
12473
12497
|
ref: observeRef
|
|
12474
12498
|
};
|
|
12475
|
-
if (
|
|
12476
|
-
state:
|
|
12477
|
-
status: "ready-meta",
|
|
12478
|
-
...metaView
|
|
12479
|
-
},
|
|
12499
|
+
if (urlView !== null) return {
|
|
12500
|
+
state: urlView,
|
|
12480
12501
|
ref: observeRef
|
|
12481
12502
|
};
|
|
12482
12503
|
if (failed) return {
|
|
@@ -21386,9 +21407,9 @@ function decodeBlockEntities(block) {
|
|
|
21386
21407
|
/**
|
|
21387
21408
|
* The materialized block's typed insertion (the `materializePaste`'s
|
|
21388
21409
|
* helpers): the type's insertion over the core's per-type attrs (the
|
|
21389
|
-
* table + its rows + the cells
|
|
21390
|
-
*
|
|
21391
|
-
*
|
|
21410
|
+
* table + its rows + the cells + the merged regions), the empty block's
|
|
21411
|
+
* in-place conversion (the typed attrs), and the runs' insertion (the
|
|
21412
|
+
* per-run marks).
|
|
21392
21413
|
*/
|
|
21393
21414
|
/** The registry's content flag: the block types that hold editable text. */
|
|
21394
21415
|
function isTextType(type) {
|
|
@@ -21476,9 +21497,47 @@ function insertBlockWithIndent(doc, type, parent, after, indent) {
|
|
|
21476
21497
|
after
|
|
21477
21498
|
});
|
|
21478
21499
|
}
|
|
21479
|
-
/**
|
|
21500
|
+
/**
|
|
21501
|
+
* The columns a merged region covers in the given row: the anchor's own row
|
|
21502
|
+
* keeps the anchor's column, the rows below lose the region's whole width.
|
|
21503
|
+
*/
|
|
21504
|
+
function coveredColumnsOf(merges, row) {
|
|
21505
|
+
return (merges ?? []).flatMap((rect) => {
|
|
21506
|
+
if (row < rect.row || row >= rect.row + rect.rowspan) return [];
|
|
21507
|
+
const first = row === rect.row ? rect.col + 1 : rect.col;
|
|
21508
|
+
return Array.from({ length: rect.col + rect.colspan - first }, (_, index) => first + index);
|
|
21509
|
+
});
|
|
21510
|
+
}
|
|
21511
|
+
/**
|
|
21512
|
+
* The table's row as a plain paragraph (the demotion over a parent that takes
|
|
21513
|
+
* no table): the cells' runs joined by the cell separator. The coordinates a
|
|
21514
|
+
* merged region covers hold no cell of their own, so they are not text either.
|
|
21515
|
+
*/
|
|
21516
|
+
function demotedTableRow(p, row) {
|
|
21517
|
+
const covered = coveredColumnsOf(p.merges, row);
|
|
21518
|
+
const cells = p.rows[row].filter((_, col) => !covered.includes(col));
|
|
21519
|
+
return {
|
|
21520
|
+
type: "paragraph",
|
|
21521
|
+
indent: p.indent,
|
|
21522
|
+
attrs: {},
|
|
21523
|
+
runs: cells.flatMap((cell, index) => index === 0 ? cell : [{
|
|
21524
|
+
text: " | ",
|
|
21525
|
+
marks: {}
|
|
21526
|
+
}, ...cell])
|
|
21527
|
+
};
|
|
21528
|
+
}
|
|
21529
|
+
/**
|
|
21530
|
+
* The table + its rows + the anchor cells: the merged regions stand the
|
|
21531
|
+
* anchor's own `colspan`/`rowspan` attrs and the coordinates they cover hold
|
|
21532
|
+
* no cell at all (the model's contract — the grid resolver derives the
|
|
21533
|
+
* placement). The cells of a row a region covers are bound to their grid
|
|
21534
|
+
* column explicitly: the insert's automatic binding is the row position, which
|
|
21535
|
+
* only matches while the row is full.
|
|
21536
|
+
*/
|
|
21480
21537
|
function insertTable(doc, m, parent, after, indent) {
|
|
21481
|
-
const
|
|
21538
|
+
const rows = m.rows;
|
|
21539
|
+
const cols = rows[0].length;
|
|
21540
|
+
const merges = m.merges ?? [];
|
|
21482
21541
|
const tableId = doc.insertBlock("table", {
|
|
21483
21542
|
cols,
|
|
21484
21543
|
indent
|
|
@@ -21486,24 +21545,41 @@ function insertTable(doc, m, parent, after, indent) {
|
|
|
21486
21545
|
parent,
|
|
21487
21546
|
after
|
|
21488
21547
|
});
|
|
21548
|
+
const table = doc.getBlock(tableId);
|
|
21549
|
+
const columnIds = table !== null && table.type === "table" ? table.columnOrder : [];
|
|
21550
|
+
const spans = [];
|
|
21489
21551
|
let prevRow = null;
|
|
21490
|
-
|
|
21552
|
+
rows.forEach((line, row) => {
|
|
21491
21553
|
const rowId = doc.insertBlock("table-row", void 0, {
|
|
21492
21554
|
parent: tableId,
|
|
21493
21555
|
after: prevRow ?? void 0
|
|
21494
21556
|
});
|
|
21557
|
+
prevRow = rowId;
|
|
21558
|
+
const covered = coveredColumnsOf(merges, row);
|
|
21559
|
+
const anchorColumns = line.map((_, col) => col).filter((col) => !covered.includes(col));
|
|
21495
21560
|
let prevCell = null;
|
|
21496
|
-
|
|
21561
|
+
anchorColumns.forEach((col, position) => {
|
|
21497
21562
|
const cellId = doc.insertBlock("table-cell", void 0, {
|
|
21498
21563
|
parent: rowId,
|
|
21499
21564
|
after: prevCell ?? void 0
|
|
21500
21565
|
});
|
|
21501
|
-
const paraId = doc.insertBlock("paragraph", void 0, { parent: cellId });
|
|
21502
|
-
if (cell.length > 0) insertRuns(doc, paraId, 0, cell);
|
|
21503
21566
|
prevCell = cellId;
|
|
21504
|
-
|
|
21505
|
-
|
|
21506
|
-
|
|
21567
|
+
const columnId = columnIds[col];
|
|
21568
|
+
if (position !== col && columnId !== void 0) doc.updateBlock(cellId, { columnId });
|
|
21569
|
+
const rect = merges.find((merge) => merge.row === row && merge.col === col);
|
|
21570
|
+
if (rect !== void 0) spans.push({
|
|
21571
|
+
cellId,
|
|
21572
|
+
rect
|
|
21573
|
+
});
|
|
21574
|
+
const paraId = doc.insertBlock("paragraph", void 0, { parent: cellId });
|
|
21575
|
+
const runs = line[col];
|
|
21576
|
+
if (runs.length > 0) insertRuns(doc, paraId, 0, runs);
|
|
21577
|
+
});
|
|
21578
|
+
});
|
|
21579
|
+
for (const { cellId, rect } of spans) doc.updateBlock(cellId, {
|
|
21580
|
+
...rect.colspan > 1 ? { colspan: rect.colspan } : {},
|
|
21581
|
+
...rect.rowspan > 1 ? { rowspan: rect.rowspan } : {}
|
|
21582
|
+
});
|
|
21507
21583
|
return tableId;
|
|
21508
21584
|
}
|
|
21509
21585
|
//#endregion
|
|
@@ -21543,21 +21619,14 @@ function materializePaste(doc, seatId, from, to, parsed, opts) {
|
|
|
21543
21619
|
return spec.childrenTypes === void 0 || spec.childrenTypes.includes(type);
|
|
21544
21620
|
};
|
|
21545
21621
|
const material = parsed.flatMap((p) => {
|
|
21546
|
-
if (p.type === "table" && !eligible("table")) return p.rows.map((
|
|
21547
|
-
type: "paragraph",
|
|
21548
|
-
indent: p.indent,
|
|
21549
|
-
attrs: {},
|
|
21550
|
-
runs: cells.flatMap((cell, index) => index === 0 ? cell : [{
|
|
21551
|
-
text: " | ",
|
|
21552
|
-
marks: {}
|
|
21553
|
-
}, ...cell])
|
|
21554
|
-
}));
|
|
21622
|
+
if (p.type === "table" && !eligible("table")) return p.rows.map((_, row) => demotedTableRow(p, row));
|
|
21555
21623
|
return [{
|
|
21556
21624
|
type: (p.type === "list-item" || p.type === "quote" ? !eligible(p.type) : false) ? "paragraph" : p.type,
|
|
21557
21625
|
indent: p.indent,
|
|
21558
21626
|
attrs: p.attrs,
|
|
21559
21627
|
runs: p.runs,
|
|
21560
|
-
rows: p.rows
|
|
21628
|
+
rows: p.rows,
|
|
21629
|
+
merges: p.merges
|
|
21561
21630
|
}];
|
|
21562
21631
|
});
|
|
21563
21632
|
const delta = seatIndent - parsed[0].indent;
|
|
@@ -21874,6 +21943,92 @@ function languageClassOf(element) {
|
|
|
21874
21943
|
for (const cls of Array.from(element.classList)) if (cls.startsWith("language-") && cls.length > 9) return cls.slice(9);
|
|
21875
21944
|
}
|
|
21876
21945
|
//#endregion
|
|
21946
|
+
//#region src/editing/clipboard/utils/html-table.ts
|
|
21947
|
+
/** The grid's width ceiling: the per-cell spans never grow it past this. */
|
|
21948
|
+
const TABLE_COLUMNS_MAX = 100;
|
|
21949
|
+
/** The grid's coordinate budget: a taller table stands fewer columns (rows x cols). */
|
|
21950
|
+
const TABLE_CELLS_MAX = 1e4;
|
|
21951
|
+
/** The span attribute's value: a non-negative integer >= 1, otherwise 1 (the invalid forms' stand). */
|
|
21952
|
+
function spanAttrOf(cell, name) {
|
|
21953
|
+
const raw = (cell.getAttribute(name) ?? "").trim();
|
|
21954
|
+
const value = /^\d+$/.test(raw) ? Number(raw) : 0;
|
|
21955
|
+
return Number.isInteger(value) && value >= 1 ? value : 1;
|
|
21956
|
+
}
|
|
21957
|
+
/** The row's `td`/`th` cells (everything else in a row is not a cell). */
|
|
21958
|
+
function cellInputsOf(row) {
|
|
21959
|
+
const cells = [];
|
|
21960
|
+
for (const cell of Array.from(row.children)) {
|
|
21961
|
+
const tag = cell.nodeName.toUpperCase();
|
|
21962
|
+
if (tag !== "TD" && tag !== "TH") continue;
|
|
21963
|
+
cells.push({
|
|
21964
|
+
runs: runsOf$1(cell, {}, false),
|
|
21965
|
+
colspan: spanAttrOf(cell, "colspan"),
|
|
21966
|
+
rowspan: spanAttrOf(cell, "rowspan")
|
|
21967
|
+
});
|
|
21968
|
+
}
|
|
21969
|
+
return cells;
|
|
21970
|
+
}
|
|
21971
|
+
/**
|
|
21972
|
+
* Places the parsed rows over the grid: the anchors take the first free
|
|
21973
|
+
* column of their row, the effective spans grow over the free coordinates
|
|
21974
|
+
* only (within the table's column budget), and the covered coordinates are
|
|
21975
|
+
* marked. The matrix is padded to the grid's width; the regions a single-cell
|
|
21976
|
+
* anchor does not need are dropped.
|
|
21977
|
+
*/
|
|
21978
|
+
function tableGridOf(rowElements) {
|
|
21979
|
+
const inputs = rowElements.map(cellInputsOf).filter((cells) => cells.length > 0);
|
|
21980
|
+
const rowCount = inputs.length;
|
|
21981
|
+
if (rowCount === 0) return null;
|
|
21982
|
+
const columnBudget = Math.max(1, Math.min(TABLE_COLUMNS_MAX, Math.floor(TABLE_CELLS_MAX / rowCount)));
|
|
21983
|
+
const occupied = [];
|
|
21984
|
+
const isOccupied = (row, col) => occupied[row]?.[col] === true;
|
|
21985
|
+
const markCovered = (row, col) => {
|
|
21986
|
+
while (occupied.length <= row) occupied.push([]);
|
|
21987
|
+
const line = occupied[row];
|
|
21988
|
+
while (line.length <= col) line.push(false);
|
|
21989
|
+
line[col] = true;
|
|
21990
|
+
};
|
|
21991
|
+
const anchors = [];
|
|
21992
|
+
inputs.forEach((cells, row) => {
|
|
21993
|
+
for (const cell of cells) {
|
|
21994
|
+
let col = 0;
|
|
21995
|
+
while (isOccupied(row, col)) col += 1;
|
|
21996
|
+
let colspan = 1;
|
|
21997
|
+
while (colspan < cell.colspan && col + colspan < columnBudget && !isOccupied(row, col + colspan)) colspan += 1;
|
|
21998
|
+
let rowspan = 1;
|
|
21999
|
+
while (rowspan < cell.rowspan && row + rowspan < rowCount) {
|
|
22000
|
+
let free = true;
|
|
22001
|
+
for (let c = 0; c < colspan; c += 1) if (isOccupied(row + rowspan, col + c)) {
|
|
22002
|
+
free = false;
|
|
22003
|
+
break;
|
|
22004
|
+
}
|
|
22005
|
+
if (!free) break;
|
|
22006
|
+
rowspan += 1;
|
|
22007
|
+
}
|
|
22008
|
+
for (let r = row; r < row + rowspan; r += 1) for (let c = col; c < col + colspan; c += 1) markCovered(r, c);
|
|
22009
|
+
anchors.push({
|
|
22010
|
+
row,
|
|
22011
|
+
col,
|
|
22012
|
+
colspan,
|
|
22013
|
+
rowspan,
|
|
22014
|
+
runs: cell.runs
|
|
22015
|
+
});
|
|
22016
|
+
}
|
|
22017
|
+
});
|
|
22018
|
+
const cols = Math.max(...occupied.map((line) => line.length));
|
|
22019
|
+
const rows = inputs.map(() => Array.from({ length: cols }, () => []));
|
|
22020
|
+
for (const anchor of anchors) rows[anchor.row][anchor.col] = anchor.runs;
|
|
22021
|
+
return {
|
|
22022
|
+
rows,
|
|
22023
|
+
merges: anchors.filter((anchor) => anchor.colspan > 1 || anchor.rowspan > 1).map(({ row, col, colspan, rowspan }) => ({
|
|
22024
|
+
row,
|
|
22025
|
+
col,
|
|
22026
|
+
colspan,
|
|
22027
|
+
rowspan
|
|
22028
|
+
}))
|
|
22029
|
+
};
|
|
22030
|
+
}
|
|
22031
|
+
//#endregion
|
|
21877
22032
|
//#region src/editing/clipboard/utils/html-blocks.ts
|
|
21878
22033
|
/**
|
|
21879
22034
|
* Parses a list element into list-item materials (the indent is the
|
|
@@ -22005,25 +22160,15 @@ function htmlToBlocks(html) {
|
|
|
22005
22160
|
listMaterialsOf(element, indent, blocks);
|
|
22006
22161
|
return;
|
|
22007
22162
|
case "TABLE": {
|
|
22008
|
-
const
|
|
22009
|
-
|
|
22010
|
-
const cells = [];
|
|
22011
|
-
for (const cell of Array.from(tr.children)) {
|
|
22012
|
-
const cellTag = cell.nodeName.toUpperCase();
|
|
22013
|
-
if (cellTag !== "TD" && cellTag !== "TH") continue;
|
|
22014
|
-
cells.push(runsOf$1(cell, {}, false));
|
|
22015
|
-
}
|
|
22016
|
-
if (cells.length > 0) rows.push(cells);
|
|
22017
|
-
}
|
|
22018
|
-
if (rows.length === 0) return;
|
|
22019
|
-
const cols = Math.max(...rows.map((row) => row.length));
|
|
22020
|
-
for (const row of rows) while (row.length < cols) row.push([]);
|
|
22163
|
+
const grid = tableGridOf(tableRowsOf(element));
|
|
22164
|
+
if (grid === null) return;
|
|
22021
22165
|
blocks.push({
|
|
22022
22166
|
type: "table",
|
|
22023
22167
|
indent,
|
|
22024
|
-
attrs: { cols },
|
|
22168
|
+
attrs: { cols: grid.rows[0].length },
|
|
22025
22169
|
runs: [],
|
|
22026
|
-
rows
|
|
22170
|
+
rows: grid.rows,
|
|
22171
|
+
merges: grid.merges
|
|
22027
22172
|
});
|
|
22028
22173
|
return;
|
|
22029
22174
|
}
|
|
@@ -29011,19 +29156,30 @@ function ImageFigure({ id, block, url, name, width, height }) {
|
|
|
29011
29156
|
* `downloadUrl`). A module-level const keeps the predicate's identity
|
|
29012
29157
|
* stable (the resolution's effect's dep). */
|
|
29013
29158
|
const IMAGE_RENDERS_BYTES = (mimeType) => mimeType.startsWith("image/") || mimeType === "application/pdf";
|
|
29159
|
+
/** The MIME the `<img>` renders straight from the store's `downloadUrl`: the
|
|
29160
|
+
* browser's own cacheable subrequest over the consumer's URL. The PDF keeps
|
|
29161
|
+
* the bytes' path (the preview and the iframe read the payload). A
|
|
29162
|
+
* module-level const keeps the predicate's identity stable (the
|
|
29163
|
+
* resolution's effect's dep). */
|
|
29164
|
+
const IMAGE_RENDERS_URL = (mimeType) => mimeType.startsWith("image/");
|
|
29014
29165
|
/**
|
|
29015
29166
|
* An image: the <img> src comes from the consumer's blob store (the key is
|
|
29016
29167
|
* opaque; resolution is a consumer-side concern). The store's MIME metadata
|
|
29017
29168
|
* decides the rendering: images stand the <img>, PDF an iframe viewer, and
|
|
29018
|
-
* legacy non-image payloads the download card.
|
|
29019
|
-
*
|
|
29020
|
-
*
|
|
29169
|
+
* legacy non-image payloads the download card. An image resolves from the
|
|
29170
|
+
* store's `downloadUrl` when it supplies one — the browser fetches and
|
|
29171
|
+
* caches it natively instead of the library's `get` + object URL. While the
|
|
29172
|
+
* id is unknown or the get is in flight the block renders a structural
|
|
29173
|
+
* placeholder card instead of a broken <img>.
|
|
29021
29174
|
*/
|
|
29022
29175
|
function ImageBlock({ id, block }) {
|
|
29023
29176
|
const { t } = useTranslation("blocks");
|
|
29024
29177
|
const { pdfPreview, blobLoading } = useEditorContext();
|
|
29025
29178
|
const src = block.attrs.src;
|
|
29026
|
-
const { state: file, ref: placeholderRef } = useBlobFile(src, IMAGE_RENDERS_BYTES,
|
|
29179
|
+
const { state: file, ref: placeholderRef } = useBlobFile(src, IMAGE_RENDERS_BYTES, {
|
|
29180
|
+
eager: blobLoading === "eager",
|
|
29181
|
+
rendersFromUrl: IMAGE_RENDERS_URL
|
|
29182
|
+
});
|
|
29027
29183
|
if (file.status === "loading" || file.status === "missing") return /* @__PURE__ */ jsx(Card, {
|
|
29028
29184
|
ref: placeholderRef,
|
|
29029
29185
|
"data-slot": "docblocks/image-placeholder",
|
|
@@ -29038,6 +29194,14 @@ function ImageBlock({ id, block }) {
|
|
|
29038
29194
|
children: [file.status === "loading" ? /* @__PURE__ */ jsx(LoaderCircle, { className: "size-6 animate-spin" }) : /* @__PURE__ */ jsx(Image$1, { className: "size-6" }), t("image.placeholder")]
|
|
29039
29195
|
})
|
|
29040
29196
|
});
|
|
29197
|
+
if (file.status === "ready-url") return /* @__PURE__ */ jsx(ImageFigure, {
|
|
29198
|
+
id,
|
|
29199
|
+
block,
|
|
29200
|
+
url: file.url,
|
|
29201
|
+
name: file.meta.name,
|
|
29202
|
+
width: file.meta.width,
|
|
29203
|
+
height: file.meta.height
|
|
29204
|
+
});
|
|
29041
29205
|
if (file.status === "ready-meta") return /* @__PURE__ */ jsx(FileCard, {
|
|
29042
29206
|
id,
|
|
29043
29207
|
fileId: src,
|
|
@@ -36531,18 +36695,20 @@ const COVER_ACCEPTED_MIME_TYPES = [
|
|
|
36531
36695
|
"image/jpeg",
|
|
36532
36696
|
"image/webp"
|
|
36533
36697
|
];
|
|
36534
|
-
/** The cover's renderable-MIME's predicate
|
|
36535
|
-
*
|
|
36536
|
-
*
|
|
36537
|
-
*
|
|
36538
|
-
*
|
|
36539
|
-
|
|
36698
|
+
/** The cover's renderable-MIME's predicate (both the bytes' path and the
|
|
36699
|
+
* store's direct URL render an image the same way). A module-level const
|
|
36700
|
+
* keeps the predicate's identity stable (the resolution's effect's dep —
|
|
36701
|
+
* an inline arrow re-runs the effect on every render). The lenient's
|
|
36702
|
+
* `image/*`'s stand: the legacy's covers may stand a format outside the
|
|
36703
|
+
* upload's strict's gate. */
|
|
36704
|
+
const COVER_RENDERS_IMAGE = (mimeType) => mimeType.startsWith("image/");
|
|
36540
36705
|
/** The cover mode's ordered options (the tile's stand stands first — the
|
|
36541
36706
|
* selector's default's stand). */
|
|
36542
36707
|
const COVER_MODE_ORDER = ["tile", "center"];
|
|
36543
36708
|
/**
|
|
36544
36709
|
* The intrinsic dimensions over a decodable image blob (the
|
|
36545
|
-
* `createImageBitmap` decode probe — the bytes are never rendered).
|
|
36710
|
+
* `createImageBitmap` decode probe — the bytes are never rendered). The
|
|
36711
|
+
* picked file's upload validation reads them before a store exists.
|
|
36546
36712
|
* `null` over an undecodable payload (the fail-open: the consumer's
|
|
36547
36713
|
* renderer may accept a format the browser cannot probe).
|
|
36548
36714
|
*/
|
|
@@ -36561,82 +36727,82 @@ async function readImageDimensions(file) {
|
|
|
36561
36727
|
return null;
|
|
36562
36728
|
}
|
|
36563
36729
|
}
|
|
36730
|
+
/**
|
|
36731
|
+
* The browser's decode over an image url: the store's direct URL or the
|
|
36732
|
+
* library's own object URL. The element carries the intrinsic dimensions,
|
|
36733
|
+
* and the tint draws it into the sample's canvas — a `blob:` url stays
|
|
36734
|
+
* same-origin, so that read never taints. `null` over an undecodable
|
|
36735
|
+
* payload.
|
|
36736
|
+
*/
|
|
36737
|
+
async function decodeImageUrl(url) {
|
|
36738
|
+
const img = new Image();
|
|
36739
|
+
img.src = url;
|
|
36740
|
+
try {
|
|
36741
|
+
await img.decode();
|
|
36742
|
+
return img;
|
|
36743
|
+
} catch {
|
|
36744
|
+
return null;
|
|
36745
|
+
}
|
|
36746
|
+
}
|
|
36747
|
+
/**
|
|
36748
|
+
* The intrinsic dimensions over a resolved image url (the display path's
|
|
36749
|
+
* probe — the browser decodes the very image the cover renders, so its own
|
|
36750
|
+
* cache serves the payload). `null` over an undecodable payload or a
|
|
36751
|
+
* zero-sized element (the fail-open stands the caller's own rendering).
|
|
36752
|
+
*/
|
|
36753
|
+
async function readUrlDimensions(url) {
|
|
36754
|
+
const img = await decodeImageUrl(url);
|
|
36755
|
+
if (img === null || img.naturalWidth === 0 || img.naturalHeight === 0) return null;
|
|
36756
|
+
return {
|
|
36757
|
+
width: img.naturalWidth,
|
|
36758
|
+
height: img.naturalHeight
|
|
36759
|
+
};
|
|
36760
|
+
}
|
|
36564
36761
|
/** The frame's tint's CSS variable (the cover's average color's stand
|
|
36565
36762
|
* over the card's element — the border's mix's input). */
|
|
36566
36763
|
const COVER_TINT_VARIABLE = "--docblocks-cover-tint-color";
|
|
36567
36764
|
/** The tint's average's sample's size (the pixel's count per side — the
|
|
36568
36765
|
* grid's area's mean over the image's downscale). */
|
|
36569
36766
|
const TINT_SAMPLE_PX = 8;
|
|
36570
|
-
/**
|
|
36571
|
-
*
|
|
36572
|
-
*
|
|
36573
|
-
*
|
|
36574
|
-
*
|
|
36575
|
-
*
|
|
36576
|
-
|
|
36577
|
-
|
|
36578
|
-
|
|
36579
|
-
|
|
36767
|
+
/**
|
|
36768
|
+
* The alpha-weighted average color over a resolved image url (the frame's
|
|
36769
|
+
* tint's / the consumer's glow's data's source): the image stands
|
|
36770
|
+
* downscaled to the sample's grid over a canvas, and the mean stands the
|
|
36771
|
+
* premultiplied's accumulation (the alpha's share per pixel) — the
|
|
36772
|
+
* transparent's stand no gray's pull (the alpha fade's cover stands its
|
|
36773
|
+
* solid's hue, not the fade's average). The `rgb(...)`'s string over the
|
|
36774
|
+
* computed's stand; `null` over an undecodable payload, the canvas's
|
|
36775
|
+
* absence, or a tainted read (a cross-origin url without CORS — the caller
|
|
36776
|
+
* stands the bytes' same-origin object URL as the fallback).
|
|
36777
|
+
*/
|
|
36778
|
+
async function averageColorOfUrl(url) {
|
|
36779
|
+
const img = await decodeImageUrl(url);
|
|
36780
|
+
if (img === null) return null;
|
|
36580
36781
|
try {
|
|
36581
|
-
|
|
36582
|
-
|
|
36782
|
+
const canvas = document.createElement("canvas");
|
|
36783
|
+
canvas.width = TINT_SAMPLE_PX;
|
|
36784
|
+
canvas.height = TINT_SAMPLE_PX;
|
|
36785
|
+
const ctx = canvas.getContext("2d");
|
|
36786
|
+
if (ctx === null) return null;
|
|
36787
|
+
ctx.drawImage(img, 0, 0, TINT_SAMPLE_PX, TINT_SAMPLE_PX);
|
|
36788
|
+
const data = ctx.getImageData(0, 0, TINT_SAMPLE_PX, TINT_SAMPLE_PX).data;
|
|
36789
|
+
let r = 0;
|
|
36790
|
+
let g = 0;
|
|
36791
|
+
let b = 0;
|
|
36792
|
+
let alphaSum = 0;
|
|
36793
|
+
for (let i = 0; i < data.length; i += 4) {
|
|
36794
|
+
const alpha = (data[i + 3] ?? 0) / 255;
|
|
36795
|
+
r += (data[i] ?? 0) * alpha;
|
|
36796
|
+
g += (data[i + 1] ?? 0) * alpha;
|
|
36797
|
+
b += (data[i + 2] ?? 0) * alpha;
|
|
36798
|
+
alphaSum += alpha;
|
|
36799
|
+
}
|
|
36800
|
+
if (alphaSum === 0) return null;
|
|
36801
|
+
const mean = (sum) => Math.round(sum / alphaSum);
|
|
36802
|
+
return `rgb(${mean(r)}, ${mean(g)}, ${mean(b)})`;
|
|
36583
36803
|
} catch {
|
|
36584
36804
|
return null;
|
|
36585
|
-
} finally {
|
|
36586
|
-
URL.revokeObjectURL(url);
|
|
36587
|
-
}
|
|
36588
|
-
}
|
|
36589
|
-
/** The average's color's cache over the blob's identity (the re-resolution's
|
|
36590
|
-
* no re-compute's stand; the store's change's new blob stands a fresh
|
|
36591
|
-
* entry — the weak key's stand keeps the dead blobs' garbage's parity).
|
|
36592
|
-
*/
|
|
36593
|
-
const tintColorCache = /* @__PURE__ */ new WeakMap();
|
|
36594
|
-
/**
|
|
36595
|
-
* The alpha-weighted average color over a decodable image blob (the
|
|
36596
|
-
* frame's tint's / the consumer's glow's data's source): the image stands
|
|
36597
|
-
* downscaled to the sample's grid over a canvas (the `img`'s decode — the
|
|
36598
|
-
* SVG's parity), and the mean stands the premultiplied's accumulation
|
|
36599
|
-
* (the alpha's share per pixel) — the transparent's stand no gray's pull
|
|
36600
|
-
* (the alpha fade's cover stands its solid's hue, not the fade's
|
|
36601
|
-
* average). The `rgb(...)`'s string over the computed's stand; `null`
|
|
36602
|
-
* over an undecodable payload or the canvas's absence (the jsdom's
|
|
36603
|
-
* fail-open's stand — the plain border's parity).
|
|
36604
|
-
*/
|
|
36605
|
-
async function averageColorOfBlob(file) {
|
|
36606
|
-
let cached = tintColorCache.get(file);
|
|
36607
|
-
if (cached === void 0) {
|
|
36608
|
-
cached = (async () => {
|
|
36609
|
-
const img = await decodeToImage(file);
|
|
36610
|
-
if (img === null) return null;
|
|
36611
|
-
try {
|
|
36612
|
-
const canvas = document.createElement("canvas");
|
|
36613
|
-
canvas.width = TINT_SAMPLE_PX;
|
|
36614
|
-
canvas.height = TINT_SAMPLE_PX;
|
|
36615
|
-
const ctx = canvas.getContext("2d");
|
|
36616
|
-
if (ctx === null) return null;
|
|
36617
|
-
ctx.drawImage(img, 0, 0, TINT_SAMPLE_PX, TINT_SAMPLE_PX);
|
|
36618
|
-
const data = ctx.getImageData(0, 0, TINT_SAMPLE_PX, TINT_SAMPLE_PX).data;
|
|
36619
|
-
let r = 0;
|
|
36620
|
-
let g = 0;
|
|
36621
|
-
let b = 0;
|
|
36622
|
-
let alphaSum = 0;
|
|
36623
|
-
for (let i = 0; i < data.length; i += 4) {
|
|
36624
|
-
const alpha = (data[i + 3] ?? 0) / 255;
|
|
36625
|
-
r += (data[i] ?? 0) * alpha;
|
|
36626
|
-
g += (data[i + 1] ?? 0) * alpha;
|
|
36627
|
-
b += (data[i + 2] ?? 0) * alpha;
|
|
36628
|
-
alphaSum += alpha;
|
|
36629
|
-
}
|
|
36630
|
-
if (alphaSum === 0) return null;
|
|
36631
|
-
const mean = (sum) => Math.round(sum / alphaSum);
|
|
36632
|
-
return `rgb(${mean(r)}, ${mean(g)}, ${mean(b)})`;
|
|
36633
|
-
} catch {
|
|
36634
|
-
return null;
|
|
36635
|
-
}
|
|
36636
|
-
})();
|
|
36637
|
-
tintColorCache.set(file, cached);
|
|
36638
36805
|
}
|
|
36639
|
-
return cached;
|
|
36640
36806
|
}
|
|
36641
36807
|
/**
|
|
36642
36808
|
* The banner's bottom fade-out's mask (the last pixels' smooth stand into
|
|
@@ -36732,6 +36898,72 @@ function centerBackgroundStyle(dimensions, containerWidthPx, url) {
|
|
|
36732
36898
|
};
|
|
36733
36899
|
}
|
|
36734
36900
|
//#endregion
|
|
36901
|
+
//#region src/attributes/use-cover-image.ts
|
|
36902
|
+
/**
|
|
36903
|
+
* The cover's resolved image over the editor's blob store: the renderable
|
|
36904
|
+
* url, where it came from, and — on demand — the intrinsic dimensions. The
|
|
36905
|
+
* cover renders the store's own `downloadUrl` when it supplies one (the
|
|
36906
|
+
* browser's cacheable subrequest, as the image block does), the fetched
|
|
36907
|
+
* bytes' object URL otherwise.
|
|
36908
|
+
*/
|
|
36909
|
+
/** The status over the blob file's resolution state. */
|
|
36910
|
+
function coverStatusOf(state) {
|
|
36911
|
+
switch (state.status) {
|
|
36912
|
+
case "loading":
|
|
36913
|
+
case "missing": return state.status;
|
|
36914
|
+
case "ready":
|
|
36915
|
+
case "ready-url": return "ready";
|
|
36916
|
+
case "ready-meta": return "unrenderable";
|
|
36917
|
+
}
|
|
36918
|
+
}
|
|
36919
|
+
/**
|
|
36920
|
+
* The intrinsic dimensions over the resolved stand: the bytes' own decode
|
|
36921
|
+
* probe over the blob, or the browser's decode of the rendered url (the
|
|
36922
|
+
* store's direct URL — its own cache serves the payload).
|
|
36923
|
+
*/
|
|
36924
|
+
function useImageDimensions(blob, url, measure) {
|
|
36925
|
+
const [dimensions, setDimensions] = useState(null);
|
|
36926
|
+
useEffect(() => {
|
|
36927
|
+
if (!measure || url === null) {
|
|
36928
|
+
setDimensions(null);
|
|
36929
|
+
return;
|
|
36930
|
+
}
|
|
36931
|
+
let alive = true;
|
|
36932
|
+
(blob === null ? readUrlDimensions(url) : readImageDimensions(blob)).then((next) => {
|
|
36933
|
+
if (alive) setDimensions(next);
|
|
36934
|
+
});
|
|
36935
|
+
return () => {
|
|
36936
|
+
alive = false;
|
|
36937
|
+
};
|
|
36938
|
+
}, [
|
|
36939
|
+
blob,
|
|
36940
|
+
url,
|
|
36941
|
+
measure
|
|
36942
|
+
]);
|
|
36943
|
+
return dimensions;
|
|
36944
|
+
}
|
|
36945
|
+
/**
|
|
36946
|
+
* The stored cover's image: the blob store's resolution (the metadata's head
|
|
36947
|
+
* lookup decides the renderable MIME and the store's direct URL's stand), and
|
|
36948
|
+
* the intrinsic dimensions over the requested measure.
|
|
36949
|
+
*/
|
|
36950
|
+
function useCoverImage(fileId, options = {}) {
|
|
36951
|
+
const { state } = useBlobFile(fileId, COVER_RENDERS_IMAGE, {
|
|
36952
|
+
eager: options.eager,
|
|
36953
|
+
rendersFromUrl: COVER_RENDERS_IMAGE
|
|
36954
|
+
});
|
|
36955
|
+
const blob = state.status === "ready" ? state.blob : null;
|
|
36956
|
+
const url = state.status === "ready" || state.status === "ready-url" ? state.url : null;
|
|
36957
|
+
const source = state.status === "ready" ? "bytes" : state.status === "ready-url" ? "url" : null;
|
|
36958
|
+
const dimensions = useImageDimensions(blob, url, options.measure === true);
|
|
36959
|
+
return {
|
|
36960
|
+
status: coverStatusOf(state),
|
|
36961
|
+
url,
|
|
36962
|
+
source,
|
|
36963
|
+
dimensions
|
|
36964
|
+
};
|
|
36965
|
+
}
|
|
36966
|
+
//#endregion
|
|
36735
36967
|
//#region src/attributes/CoverPresets.tsx
|
|
36736
36968
|
/** The cover modal's preset's surface (the modal's subcomponent over the
|
|
36737
36969
|
* `cover.ts`'s contract): the preset's cell (the consumer's store's
|
|
@@ -36754,7 +36986,7 @@ function editorWidthOf(anchor) {
|
|
|
36754
36986
|
* caller's mode (the upload's no stand — the consumer's catalog's curation
|
|
36755
36987
|
* is the gate's stand over the presets). */
|
|
36756
36988
|
function CoverPresetCell({ fileId, label, busy, onPick }) {
|
|
36757
|
-
const {
|
|
36989
|
+
const { status, url } = useCoverImage(fileId, { eager: true });
|
|
36758
36990
|
return /* @__PURE__ */ jsx("button", {
|
|
36759
36991
|
type: "button",
|
|
36760
36992
|
"data-slot": "docblocks/cover-preset",
|
|
@@ -36764,8 +36996,8 @@ function CoverPresetCell({ fileId, label, busy, onPick }) {
|
|
|
36764
36996
|
disabled: busy,
|
|
36765
36997
|
onClick: onPick,
|
|
36766
36998
|
className: "\n flex h-18 w-full items-center justify-center overflow-hidden rounded-md border border-border bg-muted\n text-muted-foreground\n hover:border-primary\n disabled:opacity-60\n ",
|
|
36767
|
-
children:
|
|
36768
|
-
src:
|
|
36999
|
+
children: status === "ready" && url !== null ? /* @__PURE__ */ jsx("img", {
|
|
37000
|
+
src: url,
|
|
36769
37001
|
alt: "",
|
|
36770
37002
|
className: "size-full object-cover"
|
|
36771
37003
|
}) : /* @__PURE__ */ jsx(Image$1, { className: "size-4" })
|
|
@@ -37007,22 +37239,25 @@ function CoverUploadModal({ anchorRef, initialMode, onCommit, onClose }) {
|
|
|
37007
37239
|
/** The cover's row's control (the file id's thumbnail / the upload's
|
|
37008
37240
|
* entry / the remove; the read-only stand stands the thumbnail
|
|
37009
37241
|
* display-only). The upload's entry opens the modal (the mode's
|
|
37010
|
-
* selector + the drop zone + the gate's stands live over it).
|
|
37242
|
+
* selector + the drop zone + the gate's stands live over it). The
|
|
37243
|
+
* thumbnail stands the store's direct URL when it supplies one, the
|
|
37244
|
+
* bytes' object URL otherwise. */
|
|
37011
37245
|
function CoverEditor({ fileId, mode, readOnly, onCommit, onClear }) {
|
|
37012
37246
|
const { t } = useTranslation("editor");
|
|
37013
|
-
const {
|
|
37247
|
+
const { status, url } = useCoverImage(fileId ?? "", { eager: true });
|
|
37014
37248
|
const [open, setOpen] = useState(false);
|
|
37015
37249
|
const anchorRef = useRef(null);
|
|
37250
|
+
const thumbnail = status === "ready" && url !== null;
|
|
37016
37251
|
return /* @__PURE__ */ jsxs("div", {
|
|
37017
37252
|
ref: anchorRef,
|
|
37018
37253
|
tabIndex: -1,
|
|
37019
37254
|
className: "flex min-w-0 items-center gap-2 outline-none",
|
|
37020
37255
|
children: [
|
|
37021
|
-
fileId !== void 0 && (
|
|
37256
|
+
fileId !== void 0 && (thumbnail || status === "unrenderable") ? /* @__PURE__ */ jsx("span", {
|
|
37022
37257
|
"data-slot": "docblocks/attributes-cover",
|
|
37023
37258
|
className: "block size-10 shrink-0 overflow-hidden rounded-md border bg-muted",
|
|
37024
|
-
children:
|
|
37025
|
-
src:
|
|
37259
|
+
children: thumbnail ? /* @__PURE__ */ jsx("img", {
|
|
37260
|
+
src: url,
|
|
37026
37261
|
alt: "",
|
|
37027
37262
|
className: "size-full object-cover"
|
|
37028
37263
|
}) : null
|
|
@@ -37073,24 +37308,10 @@ function CoverEditor({ fileId, mode, readOnly, onCommit, onClear }) {
|
|
|
37073
37308
|
const EDITOR_SELECTOR = "[data-slot=\"docblocks/editor\"]";
|
|
37074
37309
|
function CoverModeSelector({ coverId, mode, readOnly, onChange }) {
|
|
37075
37310
|
const { t } = useTranslation("editor");
|
|
37076
|
-
const {
|
|
37077
|
-
|
|
37078
|
-
|
|
37079
|
-
|
|
37080
|
-
const [dimensions, setDimensions] = useState(null);
|
|
37081
|
-
useLayoutEffect(() => {
|
|
37082
|
-
if (blob === null) {
|
|
37083
|
-
setDimensions(null);
|
|
37084
|
-
return;
|
|
37085
|
-
}
|
|
37086
|
-
let alive = true;
|
|
37087
|
-
readImageDimensions(blob).then((next) => {
|
|
37088
|
-
if (alive) setDimensions(next);
|
|
37089
|
-
});
|
|
37090
|
-
return () => {
|
|
37091
|
-
alive = false;
|
|
37092
|
-
};
|
|
37093
|
-
}, [blob]);
|
|
37311
|
+
const { dimensions } = useCoverImage(coverId, {
|
|
37312
|
+
eager: true,
|
|
37313
|
+
measure: true
|
|
37314
|
+
});
|
|
37094
37315
|
/** The editor frame's live width (the centering's gate's input): the
|
|
37095
37316
|
* anchor's nearest editor frame's box over the mount's measure + the
|
|
37096
37317
|
* resize's watch (the jsdom's no-layout's stand keeps the zero's value
|
|
@@ -37553,7 +37774,9 @@ function AttributesPanel() {
|
|
|
37553
37774
|
* over the scaled height). The banner is decoration only: the pointer's
|
|
37554
37775
|
* transparent stand keeps the page's selection and the cross-drag's
|
|
37555
37776
|
* stands untouched. The bottom's last pixels stand the fade-out's smooth
|
|
37556
|
-
* stand into the page's content.
|
|
37777
|
+
* stand into the page's content. The image stands the store's direct URL
|
|
37778
|
+
* when it supplies one (the browser's cacheable subrequest), the bytes'
|
|
37779
|
+
* object URL otherwise. */
|
|
37557
37780
|
function CoverBanner() {
|
|
37558
37781
|
const { store } = useEditorContext();
|
|
37559
37782
|
const attributes = useStore(store, (state) => state.meta).attributes;
|
|
@@ -37565,28 +37788,15 @@ function CoverBanner() {
|
|
|
37565
37788
|
});
|
|
37566
37789
|
}
|
|
37567
37790
|
/** The banner's body (the hooks' stand — the mount only over the cover's
|
|
37568
|
-
* presence, so the resolution's hook never sees the empty's id).
|
|
37791
|
+
* presence, so the resolution's hook never sees the empty's id). The
|
|
37792
|
+
* dimensions' probe runs over the centering only (the tile's fixed strip
|
|
37793
|
+
* needs no intrinsic size) — the store's direct URL serves the probe as it
|
|
37794
|
+
* serves the render. */
|
|
37569
37795
|
function CoverBannerBody({ coverId, mode }) {
|
|
37570
|
-
const {
|
|
37571
|
-
|
|
37572
|
-
|
|
37573
|
-
|
|
37574
|
-
* the fallback's plain image's stand). The tile's stand needs no probe
|
|
37575
|
-
* (the fixed's strip's height is the layout's constant). */
|
|
37576
|
-
const [dimensions, setDimensions] = useState(null);
|
|
37577
|
-
useLayoutEffect(() => {
|
|
37578
|
-
if (blob === null || mode === "tile") {
|
|
37579
|
-
setDimensions(null);
|
|
37580
|
-
return;
|
|
37581
|
-
}
|
|
37582
|
-
let alive = true;
|
|
37583
|
-
readImageDimensions(blob).then((next) => {
|
|
37584
|
-
if (alive) setDimensions(next);
|
|
37585
|
-
});
|
|
37586
|
-
return () => {
|
|
37587
|
-
alive = false;
|
|
37588
|
-
};
|
|
37589
|
-
}, [blob, mode]);
|
|
37796
|
+
const { url, dimensions } = useCoverImage(coverId, {
|
|
37797
|
+
eager: true,
|
|
37798
|
+
measure: mode === "center"
|
|
37799
|
+
});
|
|
37590
37800
|
/** The frame's live width (the centering's slice's height's input): the
|
|
37591
37801
|
* wrapper's own box (the full frame's width's stand) over the mount's
|
|
37592
37802
|
* measure + the resize's watch (the jsdom's no-layout's stand keeps the
|
|
@@ -37606,8 +37816,8 @@ function CoverBannerBody({ coverId, mode }) {
|
|
|
37606
37816
|
const observer = new ResizeObserver(measure);
|
|
37607
37817
|
observer.observe(el);
|
|
37608
37818
|
return () => observer.disconnect();
|
|
37609
|
-
}, [
|
|
37610
|
-
if (
|
|
37819
|
+
}, [url !== null]);
|
|
37820
|
+
if (url === null) return null;
|
|
37611
37821
|
return /* @__PURE__ */ jsx("div", {
|
|
37612
37822
|
ref: wrapperRef,
|
|
37613
37823
|
"data-slot": "docblocks/cover-banner",
|
|
@@ -37620,18 +37830,18 @@ function CoverBannerBody({ coverId, mode }) {
|
|
|
37620
37830
|
},
|
|
37621
37831
|
children: mode === "tile" ? /* @__PURE__ */ jsx("div", {
|
|
37622
37832
|
className: "w-full",
|
|
37623
|
-
style: tileBackgroundStyle(
|
|
37833
|
+
style: tileBackgroundStyle(url)
|
|
37624
37834
|
}) : dimensions === null ? /* @__PURE__ */ jsx("div", {
|
|
37625
37835
|
className: "flex w-full justify-center",
|
|
37626
37836
|
children: /* @__PURE__ */ jsx("img", {
|
|
37627
|
-
src:
|
|
37837
|
+
src: url,
|
|
37628
37838
|
alt: "",
|
|
37629
37839
|
className: "max-w-full",
|
|
37630
37840
|
style: { maxHeight: 150 }
|
|
37631
37841
|
})
|
|
37632
37842
|
}) : /* @__PURE__ */ jsx("div", {
|
|
37633
37843
|
className: "w-full",
|
|
37634
|
-
style: centerBackgroundStyle(dimensions, width,
|
|
37844
|
+
style: centerBackgroundStyle(dimensions, width, url)
|
|
37635
37845
|
})
|
|
37636
37846
|
});
|
|
37637
37847
|
}
|
|
@@ -37639,20 +37849,21 @@ function CoverBannerBody({ coverId, mode }) {
|
|
|
37639
37849
|
//#region src/attributes/cover-tint.tsx
|
|
37640
37850
|
/**
|
|
37641
37851
|
* The stored cover's average color (the frame's tint's / the consumer's
|
|
37642
|
-
* glow's data's source): the cover's
|
|
37643
|
-
*
|
|
37644
|
-
*
|
|
37645
|
-
*
|
|
37646
|
-
*
|
|
37647
|
-
*
|
|
37852
|
+
* glow's data's source): the cover's resolved url drawn into the sample's
|
|
37853
|
+
* canvas — the `rgb(...)`'s string or `null` over the absent's id / the
|
|
37854
|
+
* unresolved's / the undecodable's stand. The resolved url is the store's
|
|
37855
|
+
* direct URL when it supplies one; a cross-origin URL without CORS taints
|
|
37856
|
+
* the canvas, so that read falls back to the fetched bytes' same-origin
|
|
37857
|
+
* object URL (the library's own read).
|
|
37648
37858
|
*/
|
|
37649
37859
|
function useCoverAverageColor() {
|
|
37650
37860
|
const { store, blobStore } = useEditorContext();
|
|
37651
37861
|
const attributes = useStore(store, (state) => state.meta.attributes);
|
|
37652
37862
|
const coverId = typeof attributes?.cover === "string" ? attributes.cover : void 0;
|
|
37863
|
+
const { url, source } = useCoverImage(coverId ?? "", { eager: true });
|
|
37653
37864
|
const [color, setColor] = useState(null);
|
|
37654
37865
|
useEffect(() => {
|
|
37655
|
-
if (
|
|
37866
|
+
if (url === null) {
|
|
37656
37867
|
setColor(null);
|
|
37657
37868
|
return;
|
|
37658
37869
|
}
|
|
@@ -37660,15 +37871,36 @@ function useCoverAverageColor() {
|
|
|
37660
37871
|
const settle = (next) => {
|
|
37661
37872
|
if (alive) setColor(next);
|
|
37662
37873
|
};
|
|
37663
|
-
|
|
37874
|
+
/**
|
|
37875
|
+
* The bytes' read: the same-origin object URL (a `blob:` url never
|
|
37876
|
+
* taints the canvas) — the fallback over a store URL the canvas cannot
|
|
37877
|
+
* read, and the legacy resolution's own stand.
|
|
37878
|
+
*/
|
|
37879
|
+
const readBytes = async () => {
|
|
37880
|
+
if (coverId === void 0) {
|
|
37881
|
+
settle(null);
|
|
37882
|
+
return;
|
|
37883
|
+
}
|
|
37884
|
+
let blobUrl = null;
|
|
37664
37885
|
try {
|
|
37665
37886
|
const ref = await blobStore.get(coverId);
|
|
37666
|
-
|
|
37887
|
+
blobUrl = URL.createObjectURL(ref.blob);
|
|
37888
|
+
settle(await averageColorOfUrl(blobUrl));
|
|
37667
37889
|
} catch {
|
|
37668
37890
|
settle(null);
|
|
37891
|
+
} finally {
|
|
37892
|
+
if (blobUrl !== null) URL.revokeObjectURL(blobUrl);
|
|
37893
|
+
}
|
|
37894
|
+
};
|
|
37895
|
+
const load = async () => {
|
|
37896
|
+
const direct = await averageColorOfUrl(url);
|
|
37897
|
+
if (direct !== null || source !== "url") {
|
|
37898
|
+
settle(direct);
|
|
37899
|
+
return;
|
|
37669
37900
|
}
|
|
37901
|
+
await readBytes();
|
|
37670
37902
|
};
|
|
37671
|
-
const unsubscribe = blobStore.subscribe(coverId, () => {
|
|
37903
|
+
const unsubscribe = blobStore.subscribe(coverId ?? "", () => {
|
|
37672
37904
|
load();
|
|
37673
37905
|
});
|
|
37674
37906
|
load();
|
|
@@ -37676,7 +37908,12 @@ function useCoverAverageColor() {
|
|
|
37676
37908
|
alive = false;
|
|
37677
37909
|
unsubscribe();
|
|
37678
37910
|
};
|
|
37679
|
-
}, [
|
|
37911
|
+
}, [
|
|
37912
|
+
blobStore,
|
|
37913
|
+
coverId,
|
|
37914
|
+
url,
|
|
37915
|
+
source
|
|
37916
|
+
]);
|
|
37680
37917
|
return color;
|
|
37681
37918
|
}
|
|
37682
37919
|
/**
|
|
@@ -61,14 +61,19 @@ interface BlobStore {
|
|
|
61
61
|
/** Optional lightweight display resolution: file id → the metadata WITHOUT
|
|
62
62
|
* the bytes (the cheap head stand, no body transfer). The built-in
|
|
63
63
|
* file / image blocks resolve the bytes over `get` only when they render
|
|
64
|
-
* the payload (the pdf preview, the `<img>`); any other MIME
|
|
65
|
-
* meta card with the `downloadUrl`'s href. Without the member
|
|
66
|
-
* keep the legacy stand (the bytes over `get`). Rejects an
|
|
67
|
-
* (the missing's stand). */
|
|
64
|
+
* the payload (the pdf preview, the `<img>`'s fallback); any other MIME
|
|
65
|
+
* stands the meta card with the `downloadUrl`'s href. Without the member
|
|
66
|
+
* the blocks keep the legacy stand (the bytes over `get`). Rejects an
|
|
67
|
+
* unknown id (the missing's stand). */
|
|
68
68
|
getMeta?(fileId: string): Promise<BlobMeta>;
|
|
69
|
-
/** Optional direct
|
|
70
|
-
*
|
|
71
|
-
*
|
|
69
|
+
/** Optional direct URL for a file id (no object URL stands). The image
|
|
70
|
+
* block renders an image MIME straight from it — the browser's own
|
|
71
|
+
* cacheable subrequest instead of the bytes over `get` — and the meta
|
|
72
|
+
* card stands it as the download's href; a store supplies it only when the
|
|
73
|
+
* URL serves the payload inline (a `Content-Disposition: attachment`
|
|
74
|
+
* response serves the download, not the `<img>`). Without the member the
|
|
75
|
+
* download's href stands the object URL resolved over `get` (the
|
|
76
|
+
* legacy's path). */
|
|
72
77
|
downloadUrl?(fileId: string): string;
|
|
73
78
|
}
|
|
74
79
|
/** The default in-memory store: blobs live for the JS session only. */
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as PresenceCrypto, c as PresenceSharing, l as PresenceSharingMode, n as BlockRendererMap, o as PresenceIdentity, r as BlockRendererProps, s as PresencePeer, t as BlockRenderer } from "./index-DeOMnr7f.mjs";
|
|
2
|
-
import { $ as TableEnvelopeBase, A as DatabaseTablePhase, At as RenderAttribute, B as BridgeTableDescription, C as DatabaseTable, Ct as toBridgeError, D as cellValueEqual, Dt as createMemoryBlobStore, E as UseTableList, Et as BlobStore, F as FilterBuilder, G as MutationReceipt, H as CellValueParse, I as BatchOp, J as ProtocolDescriptor, K as OperationStatus, L as DatabaseBridge, M as UseDatabaseTable, N as emptyFilter, O as newMutationContext, Ot as AttributeTypePicker, P as filterIsComplete, Q as SubscriptionStatus, R as BridgeColumn, S as useTableList, St as isBridgeErrorCode, T as DatabaseTableView, Tt as BlobRef, U as DomainEvent, V as BridgeValueInput, W as MutationContext, X as SubscriptionHandle, Y as ProtocolLimits, Z as SubscriptionObserver, _ as AccessLevel, _t as TableSnapshot, a as EditorContextValue, at as Id, b as MentionInteractions, bt as BridgeErrorCode, c as SelectionRef, ct as PageSnapshot, d as PdfPreview, dt as Revision, et as TableEvent, f as PdfPreviewProps, ft as RowPage, g as DocTags, gt as TableRef, h as DocTag, ht as TableDescription, i as EditorProviderProps, it as FilterInput, j as DatabaseTableRow, jt as RenderAttributeProps, k as useDatabaseTable, kt as AttributeTypePickerProps, l as BlobLoading, lt as QueryOperator, m as DocDescription, mt as SortInput, n as DEFAULT_EMBED_SANDBOX, nt as Column, o as EmbedSandboxPolicy, ot as IsoInstant, p as CoverPresetSets, pt as RowWire, q as ProtocolCapability, r as EditorProvider, rt as FilterConditionInput, s as SyncEmbedResolver, st as PageQuery, t as useEditorContext, tt as CellMap, u as PresenceConfig, ut as QuerySemantics, v as EditorMode, vt as BRIDGE_ERROR_CODES, w as DatabaseTableProps, wt as BlobMeta, x as MentionProvider, xt as isBridgeError, y as MentionEntry, yt as BridgeError, z as BridgeColumnAnnotation } from "./index-
|
|
2
|
+
import { $ as TableEnvelopeBase, A as DatabaseTablePhase, At as RenderAttribute, B as BridgeTableDescription, C as DatabaseTable, Ct as toBridgeError, D as cellValueEqual, Dt as createMemoryBlobStore, E as UseTableList, Et as BlobStore, F as FilterBuilder, G as MutationReceipt, H as CellValueParse, I as BatchOp, J as ProtocolDescriptor, K as OperationStatus, L as DatabaseBridge, M as UseDatabaseTable, N as emptyFilter, O as newMutationContext, Ot as AttributeTypePicker, P as filterIsComplete, Q as SubscriptionStatus, R as BridgeColumn, S as useTableList, St as isBridgeErrorCode, T as DatabaseTableView, Tt as BlobRef, U as DomainEvent, V as BridgeValueInput, W as MutationContext, X as SubscriptionHandle, Y as ProtocolLimits, Z as SubscriptionObserver, _ as AccessLevel, _t as TableSnapshot, a as EditorContextValue, at as Id, b as MentionInteractions, bt as BridgeErrorCode, c as SelectionRef, ct as PageSnapshot, d as PdfPreview, dt as Revision, et as TableEvent, f as PdfPreviewProps, ft as RowPage, g as DocTags, gt as TableRef, h as DocTag, ht as TableDescription, i as EditorProviderProps, it as FilterInput, j as DatabaseTableRow, jt as RenderAttributeProps, k as useDatabaseTable, kt as AttributeTypePickerProps, l as BlobLoading, lt as QueryOperator, m as DocDescription, mt as SortInput, n as DEFAULT_EMBED_SANDBOX, nt as Column, o as EmbedSandboxPolicy, ot as IsoInstant, p as CoverPresetSets, pt as RowWire, q as ProtocolCapability, r as EditorProvider, rt as FilterConditionInput, s as SyncEmbedResolver, st as PageQuery, t as useEditorContext, tt as CellMap, u as PresenceConfig, ut as QuerySemantics, v as EditorMode, vt as BRIDGE_ERROR_CODES, w as DatabaseTableProps, wt as BlobMeta, x as MentionProvider, xt as isBridgeError, y as MentionEntry, yt as BridgeError, z as BridgeColumnAnnotation } from "./index-CE8wKsue.mjs";
|
|
3
3
|
import * as React$1 from "react";
|
|
4
4
|
import { Component, ComponentType, ErrorInfo, ReactNode } from "react";
|
|
5
5
|
import { VariantProps } from "class-variance-authority";
|
|
@@ -333,12 +333,12 @@ declare const FORMAT_PALETTE: readonly string[];
|
|
|
333
333
|
//#region src/attributes/cover-tint.d.ts
|
|
334
334
|
/**
|
|
335
335
|
* The stored cover's average color (the frame's tint's / the consumer's
|
|
336
|
-
* glow's data's source): the cover's
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
336
|
+
* glow's data's source): the cover's resolved url drawn into the sample's
|
|
337
|
+
* canvas — the `rgb(...)`'s string or `null` over the absent's id / the
|
|
338
|
+
* unresolved's / the undecodable's stand. The resolved url is the store's
|
|
339
|
+
* direct URL when it supplies one; a cross-origin URL without CORS taints
|
|
340
|
+
* the canvas, so that read falls back to the fetched bytes' same-origin
|
|
341
|
+
* object URL (the library's own read).
|
|
342
342
|
*/
|
|
343
343
|
declare function useCoverAverageColor(): string | null;
|
|
344
344
|
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { C as UnknownSlashCommandError, S as UnhandledValueError, _ as CanvasPasteError, b as HookMisuseError, g as BlobNotFoundError, s as preventDefault, v as DocBlocksUiError, w as cn, x as PdfFetchError, y as EditorProviderError } from "./constants-D_3p65rk.mjs";
|
|
2
|
-
import { $ as DropdownMenuShortcut, $t as DocblocksI18nProvider, A as Select, B as Label, Bt as CardFooter, C as cellValueEqual, Ct as isBridgeError, D as filterIsComplete, Dt as parseCellValue, E as emptyFilter, Et as conditionMatches, F as SelectScrollDownButton, Ft as Skeleton, G as DropdownMenuContent, Gt as useBlock, H as Input, Ht as CardTitle, I as SelectScrollUpButton, It as Card, J as DropdownMenuLabel, Jt as usePresence, K as DropdownMenuGroup, Kt as useDoc, L as SelectSeparator, Lt as CardAction, M as SelectGroup, Mt as Eye, N as SelectItem, O as SegmentSelector, Ot as TEXT_TYPES, P as SelectLabel, Pt as BookOpen, Q as DropdownMenuSeparator, Qt as useText, R as SelectTrigger, Rt as CardContent, S as useDatabaseTable, St as BridgeError, T as FilterBuilder, Tt as toBridgeError, U as DropdownMenu, Ut as Badge, V as InlineEditInput, Vt as CardHeader, W as DropdownMenuCheckboxItem, Wt as badgeVariants, X as DropdownMenuRadioGroup, Xt as useSelection, Y as DropdownMenuPortal, Yt as usePresenceSharing, Z as DropdownMenuRadioItem, Zt as useSelectionView, _ as mapFrontmatter, _t as BASELINE_CAPABILITIES, a as DEFAULT_EMBED_SANDBOX, at as Popover, b as renderRuns, bt as validateProtocolDescriptor, c as SHAPE_FONT_OPTIONS, ct as PopoverDescription, d as FORMAT_PALETTE, dt as PopoverTrigger, en as createMemoryBlobStore, et as DropdownMenuSub, ft as Checkbox, g as parseFrontmatter, gt as AlertTitle, h as mdToBlocks, ht as AlertDescription, i as useEditorContext, it as Separator, j as SelectContent, jt as Pen, k as ScrollArea, kt as columnAnnotation, l as SHAPE_FONT_STACKS, lt as PopoverHeader, m as insertNative, mt as Alert, n as useCoverAverageColor, nn as Button, nt as DropdownMenuSubTrigger, ot as PopoverAnchor, p as htmlToBlocks, pt as BareSelect, q as DropdownMenuItem, qt as useMeta, r as EditorProvider, rn as buttonVariants, rt as DropdownMenuTrigger, st as PopoverContent, t as Editor, tn as EditorErrorBoundary, tt as DropdownMenuSubContent, ut as PopoverTitle, v as markToggleAction, vt as PROTOCOL_VERSION, w as newMutationContext, wt as isBridgeErrorCode, x as GridBody, xt as BRIDGE_ERROR_CODES, yt as isDatabaseBridge, z as SelectValue, zt as CardDescription } from "./Editor-
|
|
2
|
+
import { $ as DropdownMenuShortcut, $t as DocblocksI18nProvider, A as Select, B as Label, Bt as CardFooter, C as cellValueEqual, Ct as isBridgeError, D as filterIsComplete, Dt as parseCellValue, E as emptyFilter, Et as conditionMatches, F as SelectScrollDownButton, Ft as Skeleton, G as DropdownMenuContent, Gt as useBlock, H as Input, Ht as CardTitle, I as SelectScrollUpButton, It as Card, J as DropdownMenuLabel, Jt as usePresence, K as DropdownMenuGroup, Kt as useDoc, L as SelectSeparator, Lt as CardAction, M as SelectGroup, Mt as Eye, N as SelectItem, O as SegmentSelector, Ot as TEXT_TYPES, P as SelectLabel, Pt as BookOpen, Q as DropdownMenuSeparator, Qt as useText, R as SelectTrigger, Rt as CardContent, S as useDatabaseTable, St as BridgeError, T as FilterBuilder, Tt as toBridgeError, U as DropdownMenu, Ut as Badge, V as InlineEditInput, Vt as CardHeader, W as DropdownMenuCheckboxItem, Wt as badgeVariants, X as DropdownMenuRadioGroup, Xt as useSelection, Y as DropdownMenuPortal, Yt as usePresenceSharing, Z as DropdownMenuRadioItem, Zt as useSelectionView, _ as mapFrontmatter, _t as BASELINE_CAPABILITIES, a as DEFAULT_EMBED_SANDBOX, at as Popover, b as renderRuns, bt as validateProtocolDescriptor, c as SHAPE_FONT_OPTIONS, ct as PopoverDescription, d as FORMAT_PALETTE, dt as PopoverTrigger, en as createMemoryBlobStore, et as DropdownMenuSub, ft as Checkbox, g as parseFrontmatter, gt as AlertTitle, h as mdToBlocks, ht as AlertDescription, i as useEditorContext, it as Separator, j as SelectContent, jt as Pen, k as ScrollArea, kt as columnAnnotation, l as SHAPE_FONT_STACKS, lt as PopoverHeader, m as insertNative, mt as Alert, n as useCoverAverageColor, nn as Button, nt as DropdownMenuSubTrigger, ot as PopoverAnchor, p as htmlToBlocks, pt as BareSelect, q as DropdownMenuItem, qt as useMeta, r as EditorProvider, rn as buttonVariants, rt as DropdownMenuTrigger, st as PopoverContent, t as Editor, tn as EditorErrorBoundary, tt as DropdownMenuSubContent, ut as PopoverTitle, v as markToggleAction, vt as PROTOCOL_VERSION, w as newMutationContext, wt as isBridgeErrorCode, x as GridBody, xt as BRIDGE_ERROR_CODES, yt as isDatabaseBridge, z as SelectValue, zt as CardDescription } from "./Editor-CDZqsAHh.mjs";
|
|
3
3
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
5
|
import { cva } from "class-variance-authority";
|
package/dist/mermaid/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as clamp, d as Plus, f as Minus, p as LoaderCircle, s as preventDefault, u as TriangleAlert } from "../constants-D_3p65rk.mjs";
|
|
2
|
-
import { At as RotateCcw, Ft as Skeleton, Mt as Eye, Nt as CodeXml, O as SegmentSelector, f as textOf, gt as AlertTitle, ht as AlertDescription, i as useEditorContext, mt as Alert, nn as Button, o as childrenSlot, s as CodeHeader, u as TextBlock, y as INLINE_CODE_CLASS } from "../Editor-
|
|
2
|
+
import { At as RotateCcw, Ft as Skeleton, Mt as Eye, Nt as CodeXml, O as SegmentSelector, f as textOf, gt as AlertTitle, ht as AlertDescription, i as useEditorContext, mt as Alert, nn as Button, o as childrenSlot, s as CodeHeader, u as TextBlock, y as INLINE_CODE_CLASS } from "../Editor-CDZqsAHh.mjs";
|
|
3
3
|
import { t as Maximize } from "../Maximize-BBHnCDWL.mjs";
|
|
4
4
|
import { useEffect, useRef, useState } from "react";
|
|
5
5
|
import { useTranslation } from "react-i18next";
|
package/dist/pdf/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as PdfPreviewProps } from "../index-
|
|
1
|
+
import { f as PdfPreviewProps } from "../index-CE8wKsue.mjs";
|
|
2
2
|
//#region src/pdf/PdfFirstPage.d.ts
|
|
3
3
|
declare function PdfFirstPage({ id, blockType, url, name }: PdfPreviewProps): import("react").JSX.Element;
|
|
4
4
|
//#endregion
|
package/package.json
CHANGED