docblocks-react-ui 0.29.2 → 0.30.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 +32 -0
- package/README.md +14 -0
- package/dist/{Editor-y3dFOZE4.mjs → Editor-CkiRKR-B.mjs} +357 -42
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/mermaid/index.mjs +1 -1
- package/dist/styles.css +14 -5
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# docblocks-react-ui
|
|
2
2
|
|
|
3
|
+
## 0.30.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 52822ae: The empty page's input stand: a full-document empty page (the edit mode)
|
|
8
|
+
stands a visible, focusable caret home (the command-palette placeholder's
|
|
9
|
+
affordance) while the root holds no blocks, so a newly created or peer-emptied
|
|
10
|
+
document is editable again. The arrival stands nothing — the untouched doc
|
|
11
|
+
gains no block and no version (the no-phantom-version invariant holds). The
|
|
12
|
+
first gesture (the click over the stand, or the first input over a pure
|
|
13
|
+
container position) materializes the first paragraph: a fresh id (the
|
|
14
|
+
reserved `${docId}-tail` stays free for the trailing-paragraph guarantee, so
|
|
15
|
+
a later non-text tail still stands its editable trailing line) and seats the
|
|
16
|
+
caret in it; the stand unmounts over the real block's row. The read-only
|
|
17
|
+
empty page stands no stand.
|
|
18
|
+
- 1459e60: The table's auto-sizing stand: a table with no stored `columnWidths`
|
|
19
|
+
(the import / the paste / the slash insert's stand) renders its columns
|
|
20
|
+
over the first row's text (one line without the wrap, the 50 px minimum
|
|
21
|
+
floor), stretched proportionally to the page column's content width — the
|
|
22
|
+
table spans the content. A sum over the container stands un-stretched
|
|
23
|
+
(the overflow scrolls). The first seam resize (the pointer's drag or the
|
|
24
|
+
keyboard's step) materializes the layout: the commit stores the full width
|
|
25
|
+
array in one transaction, and the undo reverts to the auto stand. A table
|
|
26
|
+
with stored `columnWidths` stands them un-stretched (the explicit stand's
|
|
27
|
+
priority). The slash's Table insert now stands a widthless table (the auto
|
|
28
|
+
stand) instead of the fixed 100 px default widths.
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [d7807c7]
|
|
33
|
+
- docblocks-core@0.14.0
|
|
34
|
+
|
|
3
35
|
## 0.29.2
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -207,6 +207,14 @@ document data, never on the wire):
|
|
|
207
207
|
off); the read-only gestures keep (scroll, the embed pan / zoom, the
|
|
208
208
|
canvas wheel zoom / pan). Consecutive empty text blocks render as one
|
|
209
209
|
over the read-only modes (the document data is untouched).
|
|
210
|
+
- **The empty page's input stand (the `edit` mode only):** a full-document
|
|
211
|
+
empty page (the root holds no blocks) stands a visible, focusable caret
|
|
212
|
+
home (the command-palette placeholder's affordance) so a newly created or
|
|
213
|
+
peer-emptied document is editable. The arrival stands nothing — the
|
|
214
|
+
untouched doc gains no block and no version; the first gesture (the click
|
|
215
|
+
over the stand, or the first input over a pure container position)
|
|
216
|
+
materializes the first paragraph and seats the caret in it, and the stand
|
|
217
|
+
unmounts over the real block. The read-only empty page stands no stand.
|
|
210
218
|
- Copy: the `view` mode's text stands selectable and copyable (the
|
|
211
219
|
editor's payload keeps the marks, the mentions, and the cross-block
|
|
212
220
|
ranges); a native table block copies as a spreadsheet's grid (the
|
|
@@ -309,6 +317,12 @@ attach(doc, provider);
|
|
|
309
317
|
span the grid fits; the parse never throws and the same payload always
|
|
310
318
|
imports the same document. The markdown path carries no merged cells (GFM
|
|
311
319
|
cannot express them);
|
|
320
|
+
- a table imported from markdown / HTML stores no `columnWidths` — the
|
|
321
|
+
renderer auto-sizes a table with no stored widths: the columns stand the
|
|
322
|
+
first row's text (one line, the 50 px minimum) stretched proportionally
|
|
323
|
+
to the page column's content width, and the first seam resize
|
|
324
|
+
materializes the layout (the stored `columnWidths` from then on). A table
|
|
325
|
+
with stored `columnWidths` stands them un-stretched;
|
|
312
326
|
- an empty or whitespace-only payload is a no-op (no transaction);
|
|
313
327
|
- a non-fresh document (the root has children) throws the typed
|
|
314
328
|
`ImportDocumentError` — the import fills the root, it never appends;
|
|
@@ -19993,6 +19993,36 @@ function useMentionMenu(rootRef) {
|
|
|
19993
19993
|
}
|
|
19994
19994
|
// src/editing/page-surface-dom.ts
|
|
19995
19995
|
/**
|
|
19996
|
+
* Materializes the empty page's first paragraph (the empty page's input
|
|
19997
|
+
* stand — the full document's edit mode): while the root holds no blocks,
|
|
19998
|
+
* stands a fresh first paragraph with `content` (one undo step, one wire
|
|
19999
|
+
* update) and seats the caret at its end on the next frame. A concurrently
|
|
20000
|
+
* stood block (a peer's first gesture) stands nothing. Returns the
|
|
20001
|
+
* materialized block's id, or null when the page is not empty.
|
|
20002
|
+
*
|
|
20003
|
+
* The fresh id (not the reserved `${docId}-tail`): the reserved id is the
|
|
20004
|
+
* trailing-paragraph guarantee's own stand — consuming it here would leave a
|
|
20005
|
+
* later non-text tail without its editable paragraph (the guarantee is a
|
|
20006
|
+
* no-op once the reserved block stands).
|
|
20007
|
+
*/
|
|
20008
|
+
function materializeEmptyPageParagraph(doc, scope, content) {
|
|
20009
|
+
const rootId = doc.meta.id;
|
|
20010
|
+
if (doc.getChildren(rootId).length !== 0) return null;
|
|
20011
|
+
const seat = { blockId: null };
|
|
20012
|
+
try {
|
|
20013
|
+
doc.transact(() => {
|
|
20014
|
+
if (doc.getChildren(rootId).length !== 0) return;
|
|
20015
|
+
seat.blockId = doc.insertBlock("paragraph", void 0, { parent: rootId });
|
|
20016
|
+
if (content !== "") doc.insertText(seat.blockId, 0, content);
|
|
20017
|
+
});
|
|
20018
|
+
} catch {
|
|
20019
|
+
return null;
|
|
20020
|
+
}
|
|
20021
|
+
if (seat.blockId === null) return null;
|
|
20022
|
+
focusCaretIn(seat.blockId, content.length, scope);
|
|
20023
|
+
return seat.blockId;
|
|
20024
|
+
}
|
|
20025
|
+
/**
|
|
19996
20026
|
* Whether the inner is a PAGE-SURFACE text block of its own editor scope:
|
|
19997
20027
|
* not inside a contenteditable="false" island of the same scope (the
|
|
19998
20028
|
* island's cells stand their own focused inner). An island OUTSIDE the
|
|
@@ -20151,7 +20181,7 @@ function usePageSurface() {
|
|
|
20151
20181
|
* bare-div's materialization) is suppressed and the caret re-seats into
|
|
20152
20182
|
* the nearest block's edge.
|
|
20153
20183
|
*/
|
|
20154
|
-
function usePageSurfaceDispatch(containerRef, doc, handlers) {
|
|
20184
|
+
function usePageSurfaceDispatch(containerRef, doc, handlers, emptyStand) {
|
|
20155
20185
|
const dispatch = useCallback((event, kind) => {
|
|
20156
20186
|
const container = containerRef.current;
|
|
20157
20187
|
if (container === null || event.target !== container) return;
|
|
@@ -20172,11 +20202,16 @@ function usePageSurfaceDispatch(containerRef, doc, handlers) {
|
|
|
20172
20202
|
if (containerCaretNeedsReseat(container, selection?.anchorNode ?? null) === false) return;
|
|
20173
20203
|
event.preventDefault();
|
|
20174
20204
|
const scope = container.closest("[data-slot=\"docblocks/editor\"]") ?? document;
|
|
20205
|
+
if (emptyStand && materializeEmptyPageParagraph(doc, scope, event.data ?? "") !== null) return;
|
|
20175
20206
|
reseatContainerCaret(container, scope, doc);
|
|
20176
20207
|
};
|
|
20177
20208
|
container.addEventListener("beforeinput", onBeforeInput);
|
|
20178
20209
|
return () => container.removeEventListener("beforeinput", onBeforeInput);
|
|
20179
|
-
}, [
|
|
20210
|
+
}, [
|
|
20211
|
+
containerRef,
|
|
20212
|
+
doc,
|
|
20213
|
+
emptyStand
|
|
20214
|
+
]);
|
|
20180
20215
|
return useMemo(() => ({
|
|
20181
20216
|
onKeyDown: (event) => {
|
|
20182
20217
|
dispatch(event, "keydown");
|
|
@@ -20339,7 +20374,6 @@ function insertCommand(doc, command, at, indent = 0) {
|
|
|
20339
20374
|
case "table": {
|
|
20340
20375
|
const tableId = doc.insertBlock("table", {
|
|
20341
20376
|
cols: 2,
|
|
20342
|
-
columnWidths: [DEFAULT_TABLE_COLUMN_WIDTH, DEFAULT_TABLE_COLUMN_WIDTH],
|
|
20343
20377
|
...ind
|
|
20344
20378
|
}, at);
|
|
20345
20379
|
for (let row = 0; row < 2; row++) {
|
|
@@ -32367,6 +32401,188 @@ function useTableAddChips({ rowHeights, columnWidths, addSessionRef, sessionRef,
|
|
|
32367
32401
|
onAddChipPointerCancel
|
|
32368
32402
|
};
|
|
32369
32403
|
}
|
|
32404
|
+
// src/blocks/table/table-auto-widths.ts
|
|
32405
|
+
/** The table's auto-sizing pure computation: the first row's plain text per
|
|
32406
|
+
* column (over the store's block snapshots) and the width's math (the
|
|
32407
|
+
* header-text base over the minimum floor, the proportional stretch to the
|
|
32408
|
+
* container's width). */
|
|
32409
|
+
/**
|
|
32410
|
+
* The plain text of the cell's content over the store's snapshots (the
|
|
32411
|
+
* read-only stand of the doc's `cellPlainText`): the cell's own text (the
|
|
32412
|
+
* soft breaks stand as the run's `\n`) first, then the text children's text
|
|
32413
|
+
* joined with `\n` between the blocks; the non-text children contribute
|
|
32414
|
+
* nothing to the text. Parts the cell carries no text in are skipped.
|
|
32415
|
+
*/
|
|
32416
|
+
function cellPlainTextOf(blocks, cellId) {
|
|
32417
|
+
const cell = blocks[cellId];
|
|
32418
|
+
if (cell === void 0 || cell.type !== "table-cell") return "";
|
|
32419
|
+
const parts = [];
|
|
32420
|
+
const own = textOf("content" in cell ? cell.content : void 0);
|
|
32421
|
+
if (own !== "") parts.push(own);
|
|
32422
|
+
for (const childId of cell.children ?? EMPTY_IDS) {
|
|
32423
|
+
const block = blocks[childId];
|
|
32424
|
+
if (block === void 0 || !BLOCK_REGISTRY[block.type].content) continue;
|
|
32425
|
+
const text = textOf("content" in block ? block.content : void 0);
|
|
32426
|
+
if (text !== "") parts.push(text);
|
|
32427
|
+
}
|
|
32428
|
+
return parts.join("\n");
|
|
32429
|
+
}
|
|
32430
|
+
/**
|
|
32431
|
+
* The first row's plain text per column (the auto-sizing's header basis).
|
|
32432
|
+
* The cell's `columnId` binding places the text on its column (the row's
|
|
32433
|
+
* cell order may diverge from the column order over the short-row race
|
|
32434
|
+
* residue); a merged header's text stands its anchor column (the covered
|
|
32435
|
+
* columns keep the empty stand — their base falls to the floor).
|
|
32436
|
+
*/
|
|
32437
|
+
function headerColumnTexts(blocks, table) {
|
|
32438
|
+
const columns = table.columnOrder;
|
|
32439
|
+
const texts = new Array(columns.length).fill("");
|
|
32440
|
+
const rowId = table.children?.[0];
|
|
32441
|
+
if (rowId === void 0) return texts;
|
|
32442
|
+
const row = blocks[rowId];
|
|
32443
|
+
if (row === void 0 || row.type !== "table-row") return texts;
|
|
32444
|
+
for (const cellId of row.children ?? EMPTY_IDS) {
|
|
32445
|
+
const cell = blocks[cellId];
|
|
32446
|
+
if (cell === void 0 || cell.type !== "table-cell") continue;
|
|
32447
|
+
const columnId = cell.attrs?.columnId;
|
|
32448
|
+
const index = columnId === void 0 ? -1 : columns.indexOf(columnId);
|
|
32449
|
+
if (index < 0 || texts[index] !== "") continue;
|
|
32450
|
+
const text = cellPlainTextOf(blocks, cellId);
|
|
32451
|
+
if (text !== "") texts[index] = text;
|
|
32452
|
+
}
|
|
32453
|
+
return texts;
|
|
32454
|
+
}
|
|
32455
|
+
/**
|
|
32456
|
+
* The auto-sized column widths (px). The base is a column's measured header
|
|
32457
|
+
* text width + the cell's box overhead (the padding + the border — the
|
|
32458
|
+
* text stands one line without the wrap), floored at the minimum width;
|
|
32459
|
+
* when the bases' sum stands under the container's width the columns
|
|
32460
|
+
* stretch proportionally so the table spans the content. The first
|
|
32461
|
+
* `length - 1` columns round independently; the last one absorbs the
|
|
32462
|
+
* rounding drift so the sum stands the container's width exactly (the
|
|
32463
|
+
* floor stands when the drift would dip the last column under it). A sum
|
|
32464
|
+
* at or over the container stands un-stretched (the overflow scrolls).
|
|
32465
|
+
*/
|
|
32466
|
+
function autoTableWidths(textWidths, containerWidth) {
|
|
32467
|
+
const bases = textWidths.map((width) => Math.max(Math.round(width), 50));
|
|
32468
|
+
const sum = bases.reduce((total, width) => total + width, 0);
|
|
32469
|
+
if (containerWidth <= 0 || sum >= containerWidth) return bases;
|
|
32470
|
+
const scaled = [];
|
|
32471
|
+
for (let i = 0; i < bases.length - 1; i += 1) scaled.push(Math.max(50, Math.round(bases[i] * containerWidth / sum)));
|
|
32472
|
+
const last = Math.max(50, containerWidth - scaled.reduce((total, width) => total + width, 0));
|
|
32473
|
+
scaled.push(last);
|
|
32474
|
+
return scaled;
|
|
32475
|
+
}
|
|
32476
|
+
// src/blocks/table/use-table-auto-widths.ts
|
|
32477
|
+
/** The table's auto-sizing stand: a table with no stored column widths
|
|
32478
|
+
* (the import / the paste stand) sizes its columns to the header text (one
|
|
32479
|
+
* line, the minimum floor) and stretches the sum to the container's content
|
|
32480
|
+
* width; a table with stored widths stands the doc's widths (the explicit
|
|
32481
|
+
* stand takes priority). The stand is view state only — no doc write (the
|
|
32482
|
+
* first seam gesture materializes the layout over the seam's commit). */
|
|
32483
|
+
const FALLBACK_FONT_FAMILY = "Inter, sans-serif";
|
|
32484
|
+
const FALLBACK_FONT_SIZE_PX = 16;
|
|
32485
|
+
const FALLBACK_FONT_WEIGHT = "400";
|
|
32486
|
+
const FALLBACK_CELL_PADDING_X = 8;
|
|
32487
|
+
const FALLBACK_BORDER_WIDTH = 1;
|
|
32488
|
+
/** The measuring canvas (one per page — the 2D context's `measureText`). */
|
|
32489
|
+
let measureContext;
|
|
32490
|
+
/** The text's width in the given font (the canvas's `measureText` — the
|
|
32491
|
+
* DOM's rendering stand without the layout). */
|
|
32492
|
+
function measuredTextWidth(text, font) {
|
|
32493
|
+
if (typeof document === "undefined" || text === "") return 0;
|
|
32494
|
+
if (measureContext === void 0) measureContext = document.createElement("canvas").getContext("2d") ?? null;
|
|
32495
|
+
const ctx = measureContext;
|
|
32496
|
+
if (ctx === null) return 0;
|
|
32497
|
+
ctx.font = font;
|
|
32498
|
+
return ctx.measureText(text.replace(/\s+/g, " ").trim()).width;
|
|
32499
|
+
}
|
|
32500
|
+
/** The cell padding's x component (the token's `y x` stand; the single
|
|
32501
|
+
* value stands both axes). */
|
|
32502
|
+
function cellPaddingXOf(value) {
|
|
32503
|
+
const parts = value.trim().split(/\s+/).filter((part) => part !== "");
|
|
32504
|
+
const of = (part) => {
|
|
32505
|
+
const parsed = Number.parseFloat(part);
|
|
32506
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
32507
|
+
};
|
|
32508
|
+
if (parts.length === 0) return FALLBACK_CELL_PADDING_X;
|
|
32509
|
+
return parts.length === 1 ? of(parts[0]) : of(parts[1]);
|
|
32510
|
+
}
|
|
32511
|
+
/**
|
|
32512
|
+
* The auto-sized widths over a widthless table (null = no stand: an
|
|
32513
|
+
* explicit-widths table or an unmeasurable stand). The container's width
|
|
32514
|
+
* reads the block's root (it spans the page column's content — the
|
|
32515
|
+
* consumer's width override stands, the token's value does not); the
|
|
32516
|
+
* header's font reads the root's computed style (the cells inherit the
|
|
32517
|
+
* editor's text font — no per-cell override stands), over the editor
|
|
32518
|
+
* fonts' readiness re-stand.
|
|
32519
|
+
*/
|
|
32520
|
+
function useTableAutoWidths({ store, id, block, rootRef }) {
|
|
32521
|
+
const explicit = block.attrs?.columnWidths !== void 0;
|
|
32522
|
+
const headerKey = useStore(store, (state) => {
|
|
32523
|
+
if (explicit) return "";
|
|
32524
|
+
const table = state.blocks[id];
|
|
32525
|
+
if (table === void 0 || table.type !== "table") return "";
|
|
32526
|
+
return headerColumnTexts(state.blocks, table).join("\0");
|
|
32527
|
+
});
|
|
32528
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
32529
|
+
const [textWidths, setTextWidths] = useState(null);
|
|
32530
|
+
const [fontReady, setFontReady] = useState(0);
|
|
32531
|
+
useLayoutEffect(() => {
|
|
32532
|
+
if (explicit) return;
|
|
32533
|
+
const el = rootRef.current;
|
|
32534
|
+
if (el === null || typeof ResizeObserver === "undefined") return;
|
|
32535
|
+
const measure = () => {
|
|
32536
|
+
const border = Number.parseFloat(getComputedStyle(el).getPropertyValue("--docblocks-table-border-width")) || 0;
|
|
32537
|
+
setContainerWidth(el.clientWidth - 20 - border);
|
|
32538
|
+
};
|
|
32539
|
+
measure();
|
|
32540
|
+
const observer = new ResizeObserver(measure);
|
|
32541
|
+
observer.observe(el);
|
|
32542
|
+
return () => observer.disconnect();
|
|
32543
|
+
}, [rootRef, explicit]);
|
|
32544
|
+
useLayoutEffect(() => {
|
|
32545
|
+
if (explicit) return;
|
|
32546
|
+
if (typeof document === "undefined" || document.fonts === void 0) return;
|
|
32547
|
+
let cancelled = false;
|
|
32548
|
+
document.fonts.ready.then(() => {
|
|
32549
|
+
if (!cancelled) setFontReady((tick) => tick + 1);
|
|
32550
|
+
}).catch(() => void 0);
|
|
32551
|
+
return () => {
|
|
32552
|
+
cancelled = true;
|
|
32553
|
+
};
|
|
32554
|
+
}, [explicit]);
|
|
32555
|
+
useLayoutEffect(() => {
|
|
32556
|
+
if (explicit) return;
|
|
32557
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
32558
|
+
const el = rootRef.current;
|
|
32559
|
+
if (el === null) return;
|
|
32560
|
+
const blocks = store.getState().blocks;
|
|
32561
|
+
const table = blocks[id];
|
|
32562
|
+
if (table === void 0 || table.type !== "table") return;
|
|
32563
|
+
const style = getComputedStyle(el);
|
|
32564
|
+
const fontFamily = style.fontFamily !== "" ? style.fontFamily : FALLBACK_FONT_FAMILY;
|
|
32565
|
+
const fontSize = Number.parseFloat(style.fontSize) || FALLBACK_FONT_SIZE_PX;
|
|
32566
|
+
const font = `${style.fontWeight !== "" ? style.fontWeight : FALLBACK_FONT_WEIGHT} ${fontSize}px ${fontFamily}`;
|
|
32567
|
+
const overhead = 2 * cellPaddingXOf(style.getPropertyValue("--docblocks-table-cell-padding")) + (Number.parseFloat(style.getPropertyValue("--docblocks-table-border-width")) || FALLBACK_BORDER_WIDTH);
|
|
32568
|
+
setTextWidths(headerColumnTexts(blocks, table).map((text) => measuredTextWidth(text, font) + overhead));
|
|
32569
|
+
}, [
|
|
32570
|
+
store,
|
|
32571
|
+
id,
|
|
32572
|
+
explicit,
|
|
32573
|
+
fontReady,
|
|
32574
|
+
headerKey,
|
|
32575
|
+
rootRef
|
|
32576
|
+
]);
|
|
32577
|
+
return useMemo(() => {
|
|
32578
|
+
if (explicit || containerWidth <= 0 || textWidths === null) return null;
|
|
32579
|
+
return autoTableWidths(textWidths, containerWidth);
|
|
32580
|
+
}, [
|
|
32581
|
+
explicit,
|
|
32582
|
+
textWidths,
|
|
32583
|
+
containerWidth
|
|
32584
|
+
]);
|
|
32585
|
+
}
|
|
32370
32586
|
// src/blocks/table/use-table-cell-menu.ts
|
|
32371
32587
|
/** The table cell's right-click menu (copy / paste / clear): the
|
|
32372
32588
|
* release-open gesture (the held right press's open stands the gesture's
|
|
@@ -32593,17 +32809,19 @@ function useTableHandleActions({ doc, rows, tableBlockId, setMenu, scrollRef })
|
|
|
32593
32809
|
* against the table's edges), the release (a non-drag press opens the
|
|
32594
32810
|
* handle's menu; a drag commits the move after validating the live doc
|
|
32595
32811
|
* against the press-time snapshot — a concurrent structural change stands,
|
|
32596
|
-
* no command, the rows resync from the doc), and the cancel. The
|
|
32812
|
+
* no command, the rows resync from the doc), and the cancel. The drop's
|
|
32813
|
+
* widths stand the rendered stand (the doc's or the auto-sized ones — the
|
|
32814
|
+
* on-screen geometry's truth). The preview's
|
|
32597
32815
|
* state stands in the hook (the view reads the dragged row/column's live
|
|
32598
32816
|
* position + the parting shift). */
|
|
32599
|
-
function useTableHandleDrag({ sessionRef, setHover, setMenu, tableEl, doc, rows, block, id }) {
|
|
32817
|
+
function useTableHandleDrag({ sessionRef, setHover, setMenu, tableEl, doc, rows, block, widths, id }) {
|
|
32600
32818
|
const [preview, setPreview] = useState(null);
|
|
32601
32819
|
const onHandlePointerDown = (kind, index) => (event) => {
|
|
32602
32820
|
if (event.button !== 0 || sessionRef.current !== null) return;
|
|
32603
32821
|
event.preventDefault();
|
|
32604
32822
|
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
32605
32823
|
const table = tableEl();
|
|
32606
|
-
const startSize = kind === "column" ?
|
|
32824
|
+
const startSize = kind === "column" ? widths[index] ?? DEFAULT_TABLE_COLUMN_WIDTH : table?.querySelectorAll("tbody > tr")[index]?.offsetHeight ?? 0;
|
|
32607
32825
|
sessionRef.current = {
|
|
32608
32826
|
kind,
|
|
32609
32827
|
index,
|
|
@@ -32622,15 +32840,16 @@ function useTableHandleDrag({ sessionRef, setHover, setMenu, tableEl, doc, rows,
|
|
|
32622
32840
|
* pre-move doc index of the landing slot) for a pointer x: the
|
|
32623
32841
|
* stationary columns' widths (the dragged column's own width is
|
|
32624
32842
|
* excluded) against the table's left edge — the release's commit and
|
|
32625
|
-
* the live parting preview share the measurement.
|
|
32843
|
+
* the live parting preview share the measurement. A structural change
|
|
32844
|
+
* (the column count) stands the no-drop.
|
|
32626
32845
|
*/
|
|
32627
32846
|
const columnToIndexAt = (clientX, excludeIndex) => {
|
|
32628
32847
|
const table = tableEl();
|
|
32629
32848
|
if (table === null) return null;
|
|
32630
32849
|
const live = doc.getBlock(id);
|
|
32631
|
-
if (live === null || live.type !== "table") return null;
|
|
32850
|
+
if (live === null || live.type !== "table" || live.columnOrder.length !== widths.length) return null;
|
|
32632
32851
|
const rect = table.getBoundingClientRect();
|
|
32633
|
-
return columnDropPosition(
|
|
32852
|
+
return columnDropPosition(widths.filter((_, i) => i !== excludeIndex), clientX - rect.left);
|
|
32634
32853
|
};
|
|
32635
32854
|
/** The dragged row's drop index (the final visible index — the pre-move
|
|
32636
32855
|
* doc index of the landing slot) for a pointer y: the stationary rows'
|
|
@@ -32840,16 +33059,37 @@ function useTableRegions({ doc, tableId }) {
|
|
|
32840
33059
|
/** The table's column-seam resize: the seam's press + drag (the live
|
|
32841
33060
|
* preview overrides the dragged column's width — no wire traffic until the
|
|
32842
33061
|
* release commits the width), the release (the clamped width commits when
|
|
32843
|
-
* it changed — one
|
|
32844
|
-
* the cancel. The
|
|
33062
|
+
* it changed — one transact, one undo step; a 0 px drag stands a no-op), and
|
|
33063
|
+
* the cancel. The commit stands the table's final widths over the whole
|
|
33064
|
+
* column set: an equal-value set is a zero-byte no-op (a width-set table
|
|
33065
|
+
* writes only the changed column), and a widthless table (the auto-sizing's
|
|
33066
|
+
* stand) materializes the full layout over the first gesture. The preview's
|
|
33067
|
+
* state stands in the hook (the view's read of
|
|
32845
33068
|
* the dragged column's width). */
|
|
32846
|
-
function useTableSeamResize({
|
|
33069
|
+
function useTableSeamResize({ widths, doc, id, resizeSessionRef }) {
|
|
32847
33070
|
const [resizePreview, setResizePreview] = useState(null);
|
|
33071
|
+
/**
|
|
33072
|
+
* The width's commit: the final widths over the whole column set in one
|
|
33073
|
+
* transact (one undo step, one wire update). The unchanged columns stand
|
|
33074
|
+
* their standing widths (the equal-value no-op writes nothing); the
|
|
33075
|
+
* widthless table's first gesture stands the full layout's materialization
|
|
33076
|
+
* (the auto's stand takes its explicit's stand). A structural change over
|
|
33077
|
+
* the column count (a concurrent restructure) stands the no-commit.
|
|
33078
|
+
*/
|
|
33079
|
+
const commitWidths = (index, width) => {
|
|
33080
|
+
const live = doc.getBlock(id);
|
|
33081
|
+
if (live === null || live.type !== "table" || live.columnOrder.length !== widths.length) return;
|
|
33082
|
+
try {
|
|
33083
|
+
doc.transact(() => {
|
|
33084
|
+
for (let i = 0; i < widths.length; i += 1) doc.setTableColumnWidth(id, i, i === index ? width : widths[i]);
|
|
33085
|
+
});
|
|
33086
|
+
} catch {}
|
|
33087
|
+
};
|
|
32848
33088
|
const onSeamPointerDown = (col) => (event) => {
|
|
32849
33089
|
if (event.button !== 0 || resizeSessionRef.current !== null) return;
|
|
32850
33090
|
event.preventDefault();
|
|
32851
33091
|
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
32852
|
-
const startWidth =
|
|
33092
|
+
const startWidth = widths[col - 1] ?? 50;
|
|
32853
33093
|
resizeSessionRef.current = {
|
|
32854
33094
|
col,
|
|
32855
33095
|
startX: event.clientX,
|
|
@@ -32868,7 +33108,7 @@ function useTableSeamResize({ docWidths, doc, id, resizeSessionRef }) {
|
|
|
32868
33108
|
};
|
|
32869
33109
|
/**
|
|
32870
33110
|
* The seam release: the clamped width commits when it changed (one
|
|
32871
|
-
*
|
|
33111
|
+
* transact, one undo step); a 0 px drag stands a no-op (no wire traffic).
|
|
32872
33112
|
*/
|
|
32873
33113
|
const onSeamPointerUp = (event) => {
|
|
32874
33114
|
const session = resizeSessionRef.current;
|
|
@@ -32876,25 +33116,25 @@ function useTableSeamResize({ docWidths, doc, id, resizeSessionRef }) {
|
|
|
32876
33116
|
setResizePreview(null);
|
|
32877
33117
|
if (session === null || session.width === session.startWidth) return;
|
|
32878
33118
|
event.currentTarget.releasePointerCapture?.(event.pointerId);
|
|
32879
|
-
|
|
32880
|
-
doc.setTableColumnWidth(id, session.col - 1, session.width);
|
|
32881
|
-
} catch {}
|
|
33119
|
+
commitWidths(session.col - 1, session.width);
|
|
32882
33120
|
};
|
|
32883
33121
|
/**
|
|
32884
33122
|
* The seam's keyboard resize (the ARIA separator's pattern): the arrows
|
|
32885
|
-
* step the column's width by the key step — one
|
|
32886
|
-
*
|
|
33123
|
+
* step the column's width by the key step — one commit per press (one
|
|
33124
|
+
* undo step), the clamp stands the no-op at the edges. The start stands
|
|
33125
|
+
* the stored width (the explicit's stand) or the rendered width over a
|
|
33126
|
+
* widthless table (the auto's stand — the minimum's stand would stand a
|
|
33127
|
+
* jump).
|
|
32887
33128
|
*/
|
|
32888
33129
|
const onSeamKeyDown = (col) => (event) => {
|
|
32889
33130
|
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
|
|
32890
33131
|
event.preventDefault();
|
|
32891
33132
|
const table = doc.getBlock(id);
|
|
32892
|
-
|
|
33133
|
+
if (table === null || table.type !== "table") return;
|
|
33134
|
+
const current = table.attrs?.columnWidths?.[col - 1] ?? widths[col - 1] ?? 50;
|
|
32893
33135
|
const next = clampColumnWidth(current + (event.key === "ArrowRight" ? 8 : -8));
|
|
32894
33136
|
if (next === current) return;
|
|
32895
|
-
|
|
32896
|
-
doc.setTableColumnWidth(id, col - 1, next);
|
|
32897
|
-
} catch {}
|
|
33137
|
+
commitWidths(col - 1, next);
|
|
32898
33138
|
};
|
|
32899
33139
|
const onSeamPointerCancel = () => {
|
|
32900
33140
|
resizeSessionRef.current = null;
|
|
@@ -32945,8 +33185,12 @@ function useTableStructureGuard(structureKey, open, close) {
|
|
|
32945
33185
|
*
|
|
32946
33186
|
* Layout: the width is the sum of the column widths (the `columnWidths`
|
|
32947
33187
|
* attr; an absent entry falls back to the default) under `table-fixed`; a
|
|
32948
|
-
* wider-than-the-page table scrolls horizontally.
|
|
32949
|
-
*
|
|
33188
|
+
* wider-than-the-page table scrolls horizontally. A widthless table (no
|
|
33189
|
+
* stored widths — the import / the paste's stand) auto-sizes: the columns
|
|
33190
|
+
* stand the header text (the minimum's floor) over the container's content
|
|
33191
|
+
* width (`use-table-auto-widths` — no doc write; the first seam gesture
|
|
33192
|
+
* materializes the layout). The cell background is the column color over
|
|
33193
|
+
* the row color (the column wins).
|
|
32950
33194
|
*
|
|
32951
33195
|
* The chrome stands over the gesture modules: the handles' reorder drag +
|
|
32952
33196
|
* the menu (`TableHandles` + `use-table-handle-drag` +
|
|
@@ -32959,24 +33203,30 @@ function useTableStructureGuard(structureKey, open, close) {
|
|
|
32959
33203
|
* over `use-table-metrics`.
|
|
32960
33204
|
*/
|
|
32961
33205
|
function TableBlock({ id, block }) {
|
|
32962
|
-
const { doc, viewMode } = useEditorContext();
|
|
33206
|
+
const { doc, viewMode, store } = useEditorContext();
|
|
32963
33207
|
const palette = useFormatPalette();
|
|
32964
33208
|
const rows = block.children ?? EMPTY_IDS;
|
|
32965
33209
|
const contextValue = useBlockContextValue(id, rows, "table");
|
|
32966
33210
|
const docWidths = Array.from({ length: block.columnOrder.length }, (_, index) => block.attrs?.columnWidths?.[index] ?? DEFAULT_TABLE_COLUMN_WIDTH);
|
|
33211
|
+
const frameRef = useRef(null);
|
|
33212
|
+
const baseWidths = useTableAutoWidths({
|
|
33213
|
+
store,
|
|
33214
|
+
id,
|
|
33215
|
+
block,
|
|
33216
|
+
rootRef: frameRef
|
|
33217
|
+
}) ?? docWidths;
|
|
32967
33218
|
const resizeSessionRef = useRef(null);
|
|
32968
33219
|
const { resizePreview, onSeamPointerDown, onSeamPointerMove, onSeamPointerUp, onSeamPointerCancel, onSeamKeyDown } = useTableSeamResize({
|
|
32969
|
-
|
|
33220
|
+
widths: baseWidths,
|
|
32970
33221
|
doc,
|
|
32971
33222
|
id,
|
|
32972
33223
|
resizeSessionRef
|
|
32973
33224
|
});
|
|
32974
|
-
const widths = resizePreview !== null ?
|
|
33225
|
+
const widths = resizePreview !== null ? baseWidths.map((width, i) => i === resizePreview.col - 1 ? resizePreview.width : width) : baseWidths;
|
|
32975
33226
|
const tableWidth = widths.reduce((sum, width) => sum + width, 0);
|
|
32976
33227
|
const scrollRef = useRef(null);
|
|
32977
33228
|
const [menu, setMenu] = useState(null);
|
|
32978
33229
|
const sessionRef = useRef(null);
|
|
32979
|
-
const frameRef = useRef(null);
|
|
32980
33230
|
const addSessionRef = useRef(null);
|
|
32981
33231
|
const [addPreview, setAddPreview] = useState(null);
|
|
32982
33232
|
const addDragClickRef = useRef(false);
|
|
@@ -33011,6 +33261,7 @@ function TableBlock({ id, block }) {
|
|
|
33011
33261
|
doc,
|
|
33012
33262
|
rows,
|
|
33013
33263
|
block,
|
|
33264
|
+
widths: baseWidths,
|
|
33014
33265
|
id
|
|
33015
33266
|
});
|
|
33016
33267
|
const { rangeHandlers } = useTableCellRangeWiring({
|
|
@@ -39304,6 +39555,65 @@ function CoverTintController({ cardRef }) {
|
|
|
39304
39555
|
}, [cardRef, color]);
|
|
39305
39556
|
return null;
|
|
39306
39557
|
}
|
|
39558
|
+
// src/editing/EmptyPageActivation.tsx
|
|
39559
|
+
/**
|
|
39560
|
+
* The empty page's input stand: a local contenteditable that stands over an
|
|
39561
|
+
* empty page (the full document, the page view, the edit mode) so the page
|
|
39562
|
+
* has a visible, focusable caret home while the root holds no blocks. The
|
|
39563
|
+
* FIRST gesture (the mousedown over the stand) materializes the first
|
|
39564
|
+
* paragraph (one transaction, one undo step, one wire update) and seats the
|
|
39565
|
+
* caret in it; from there the real block's input path takes over (the normal
|
|
39566
|
+
* page surface's commit). Nothing is written while the stand merely stands —
|
|
39567
|
+
* an untouched document stands no version.
|
|
39568
|
+
*
|
|
39569
|
+
* The first paragraph takes a FRESH id (not the reserved `${docId}-tail`):
|
|
39570
|
+
* the reserved id is the trailing-paragraph guarantee's own stand, and
|
|
39571
|
+
* consuming it here would leave a later non-text tail without its editable
|
|
39572
|
+
* paragraph (the guarantee is a no-op once the reserved block stands). Two
|
|
39573
|
+
* peers' simultaneous first gestures stand one paragraph each — the rare
|
|
39574
|
+
* race converges over the wire to two lines, each peer's text intact.
|
|
39575
|
+
*
|
|
39576
|
+
* The stand's own content is never committed (the store-driven swap renders
|
|
39577
|
+
* the real paragraph the moment one stands, unmounting the stand), so it
|
|
39578
|
+
* stands no input/paste handlers of its own: the page surface dispatches
|
|
39579
|
+
* container-targeted input, and the seat re-targets the caret into the
|
|
39580
|
+
* materialized block's inner on the next frame.
|
|
39581
|
+
*/
|
|
39582
|
+
function EmptyPageActivation() {
|
|
39583
|
+
const { doc, commandPalettePlaceholder } = useEditorContext();
|
|
39584
|
+
const { t: tEditor } = useTranslation("editor");
|
|
39585
|
+
const ref = useRef(null);
|
|
39586
|
+
const materializedRef = useRef(false);
|
|
39587
|
+
const onMouseDown = (event) => {
|
|
39588
|
+
if (materializedRef.current) return;
|
|
39589
|
+
const rootId = doc.meta.id;
|
|
39590
|
+
if (doc.getChildren(rootId).length !== 0) return;
|
|
39591
|
+
const scope = ref.current?.closest("[data-slot=\"docblocks/editor\"]") ?? document;
|
|
39592
|
+
let paragraph = null;
|
|
39593
|
+
try {
|
|
39594
|
+
doc.transact(() => {
|
|
39595
|
+
if (doc.getChildren(rootId).length !== 0) return;
|
|
39596
|
+
paragraph = doc.insertBlock("paragraph", void 0, { parent: rootId });
|
|
39597
|
+
});
|
|
39598
|
+
} catch {
|
|
39599
|
+
return;
|
|
39600
|
+
}
|
|
39601
|
+
if (paragraph === null) return;
|
|
39602
|
+
materializedRef.current = true;
|
|
39603
|
+
event.preventDefault();
|
|
39604
|
+
focusCaretIn(paragraph, 0, scope);
|
|
39605
|
+
};
|
|
39606
|
+
return /* @__PURE__ */ jsx("div", {
|
|
39607
|
+
ref,
|
|
39608
|
+
contentEditable: true,
|
|
39609
|
+
suppressContentEditableWarning: true,
|
|
39610
|
+
spellCheck: false,
|
|
39611
|
+
"data-slot": "docblocks/empty-page",
|
|
39612
|
+
"data-placeholder": commandPalettePlaceholder ?? tEditor("commandPalettePlaceholder"),
|
|
39613
|
+
className: "min-h-(--docblocks-line-box-height) w-full cursor-text outline-none",
|
|
39614
|
+
onMouseDown
|
|
39615
|
+
});
|
|
39616
|
+
}
|
|
39307
39617
|
// src/editing/cross-drag/page-guards.ts
|
|
39308
39618
|
/** The editor root's page-flow mousedown guard (the span model's native
|
|
39309
39619
|
* selection suppression) and the triple press's whole-block select — the
|
|
@@ -41192,7 +41502,8 @@ function Editor({ view = "page", formatPalette = FORMAT_PALETTE }) {
|
|
|
41192
41502
|
const pageRef = useRef(null);
|
|
41193
41503
|
const surfaceMapRef = useRef(null);
|
|
41194
41504
|
if (surfaceMapRef.current === null) surfaceMapRef.current = /* @__PURE__ */ new Map();
|
|
41195
|
-
const
|
|
41505
|
+
const emptyStand = rootBlockId === doc.meta.id && !viewMode;
|
|
41506
|
+
const surface = usePageSurfaceDispatch(pageRef, doc, surfaceMapRef.current, emptyStand);
|
|
41196
41507
|
const { nodesById, collapsedRowKeys } = usePageSequence({
|
|
41197
41508
|
store,
|
|
41198
41509
|
rootChildren,
|
|
@@ -41293,18 +41604,22 @@ function Editor({ view = "page", formatPalette = FORMAT_PALETTE }) {
|
|
|
41293
41604
|
onInput: surface.onInput,
|
|
41294
41605
|
onPaste: surface.onPaste,
|
|
41295
41606
|
className: "\n mx-auto w-full max-w-(--docblocks-page-column-max-width) px-(--docblocks-page-padding-x)\n ",
|
|
41296
|
-
children: [
|
|
41297
|
-
|
|
41298
|
-
|
|
41299
|
-
|
|
41300
|
-
|
|
41301
|
-
|
|
41302
|
-
|
|
41303
|
-
|
|
41304
|
-
|
|
41305
|
-
|
|
41306
|
-
|
|
41307
|
-
|
|
41607
|
+
children: [
|
|
41608
|
+
/* @__PURE__ */ jsx(AttributesPanel, {}),
|
|
41609
|
+
/* @__PURE__ */ jsx(RowList, {
|
|
41610
|
+
order,
|
|
41611
|
+
nodesById,
|
|
41612
|
+
layoutSlide: layoutSlide || draggingKey !== null,
|
|
41613
|
+
draggingKey,
|
|
41614
|
+
previewIndent,
|
|
41615
|
+
animated: enterGate.current,
|
|
41616
|
+
onReorder: onRowReorder,
|
|
41617
|
+
onDragStart: onRowDragStart,
|
|
41618
|
+
onDragMove: onRowDragMove,
|
|
41619
|
+
onDragEnd: onRowDragEnd
|
|
41620
|
+
}),
|
|
41621
|
+
rootBlockId === doc.meta.id && !viewMode && rootChildren.length === 0 ? /* @__PURE__ */ jsx(EmptyPageActivation, {}) : null
|
|
41622
|
+
]
|
|
41308
41623
|
})
|
|
41309
41624
|
}), viewMode ? null : /* @__PURE__ */ jsx(PresenceCaretOverlay, { rootRef })]
|
|
41310
41625
|
})
|
package/dist/index.d.mts
CHANGED
|
@@ -404,14 +404,14 @@ declare function Alert({ className, variant, ...props }: React$1.ComponentProps<
|
|
|
404
404
|
declare function AlertTitle({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
405
405
|
declare function AlertDescription({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
406
406
|
declare const badgeVariants: (props?: ({
|
|
407
|
-
variant?: "default" | "destructive" | "
|
|
407
|
+
variant?: "default" | "destructive" | "custom" | "secondary" | "outline" | null | undefined;
|
|
408
408
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
409
409
|
declare function Badge({ className, variant, asChild, ...props }: React$1.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
|
|
410
410
|
asChild?: boolean;
|
|
411
411
|
}): React$1.JSX.Element;
|
|
412
412
|
declare function BareSelect({ className, children, ...props }: React$1.ComponentProps<"select">): React$1.JSX.Element;
|
|
413
413
|
declare const buttonVariants: (props?: ({
|
|
414
|
-
variant?: "default" | "destructive" | "
|
|
414
|
+
variant?: "default" | "destructive" | "secondary" | "outline" | "ghost" | "link" | null | undefined;
|
|
415
415
|
size?: "default" | "sm" | "lg" | "icon" | "xl" | null | undefined;
|
|
416
416
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
417
417
|
declare function Button({ className, variant, size, asChild, type, ...props }: React$1.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as DropdownMenuShortcut, $t as useText, A as Select, At as columnAnnotation, B as Label, Bt as CardDescription, C as cellValueEqual, Ct as isBridgeErrorCode, D as filterIsComplete, Dt as conditionMatches, E as emptyFilter, Et as ENUM_OPTION_NAME_COLUMN, F as SelectScrollDownButton, Ft as BookOpen, G as DropdownMenuContent, Gt as badgeVariants, H as Input, Ht as CardHeader, I as SelectScrollUpButton, It as Skeleton, J as DropdownMenuLabel, Jt as useMeta, K as DropdownMenuGroup, Kt as useBlock, L as SelectSeparator, Lt as Card, M as SelectGroup, Mt as Pen, N as SelectItem, Nt as Eye, O as SegmentSelector, Ot as parseCellValue, P as SelectLabel, Q as DropdownMenuSeparator, Qt as useSelectionView, R as SelectTrigger, Rt as CardAction, S as useDatabaseTable, St as isBridgeError, T as FilterBuilder, Tt as ENUM_OPTION_COLOR_COLUMN, U as DropdownMenu, Ut as CardTitle, V as InlineEditInput, Vt as CardFooter, W as DropdownMenuCheckboxItem, Wt as Badge, X as DropdownMenuRadioGroup, Xt as usePresenceSharing, Y as DropdownMenuPortal, Yt as usePresence, Z as DropdownMenuRadioItem, Zt as useSelection, _ as mapFrontmatter, _t as PROTOCOL_VERSION, a as DEFAULT_EMBED_SANDBOX, at as Popover, b as renderRuns, bt as BRIDGE_ERROR_CODES, c as SHAPE_FONT_OPTIONS, ct as PopoverDescription, d as FORMAT_PALETTE, dt as PopoverTrigger, en as DocblocksI18nProvider, et as DropdownMenuSub, ft as Checkbox, g as parseFrontmatter, gt as BASELINE_CAPABILITIES, h as mdToBlocks, ht as AlertTitle, i as useEditorContext, in as buttonVariants, it as Separator, j as SelectContent, k as ScrollArea, kt as TEXT_TYPES, l as SHAPE_FONT_STACKS, lt as PopoverHeader, m as insertNative, mt as AlertDescription, n as useCoverAverageColor, nn as EditorErrorBoundary, nt as DropdownMenuSubTrigger, ot as PopoverAnchor, p as htmlToBlocks, pt as Alert, q as DropdownMenuItem, qt as useDoc, r as EditorProvider, rn as Button, rt as DropdownMenuTrigger, st as PopoverContent, t as Editor, tn as createMemoryBlobStore, tt as DropdownMenuSubContent, ut as PopoverTitle, v as markToggleAction, vt as isDatabaseBridge, w as newMutationContext, wt as toBridgeError, x as GridBody, xt as BridgeError, yt as validateProtocolDescriptor, z as SelectValue, zt as CardContent } from "./Editor-
|
|
1
|
+
import { $ as DropdownMenuShortcut, $t as useText, A as Select, At as columnAnnotation, B as Label, Bt as CardDescription, C as cellValueEqual, Ct as isBridgeErrorCode, D as filterIsComplete, Dt as conditionMatches, E as emptyFilter, Et as ENUM_OPTION_NAME_COLUMN, F as SelectScrollDownButton, Ft as BookOpen, G as DropdownMenuContent, Gt as badgeVariants, H as Input, Ht as CardHeader, I as SelectScrollUpButton, It as Skeleton, J as DropdownMenuLabel, Jt as useMeta, K as DropdownMenuGroup, Kt as useBlock, L as SelectSeparator, Lt as Card, M as SelectGroup, Mt as Pen, N as SelectItem, Nt as Eye, O as SegmentSelector, Ot as parseCellValue, P as SelectLabel, Q as DropdownMenuSeparator, Qt as useSelectionView, R as SelectTrigger, Rt as CardAction, S as useDatabaseTable, St as isBridgeError, T as FilterBuilder, Tt as ENUM_OPTION_COLOR_COLUMN, U as DropdownMenu, Ut as CardTitle, V as InlineEditInput, Vt as CardFooter, W as DropdownMenuCheckboxItem, Wt as Badge, X as DropdownMenuRadioGroup, Xt as usePresenceSharing, Y as DropdownMenuPortal, Yt as usePresence, Z as DropdownMenuRadioItem, Zt as useSelection, _ as mapFrontmatter, _t as PROTOCOL_VERSION, a as DEFAULT_EMBED_SANDBOX, at as Popover, b as renderRuns, bt as BRIDGE_ERROR_CODES, c as SHAPE_FONT_OPTIONS, ct as PopoverDescription, d as FORMAT_PALETTE, dt as PopoverTrigger, en as DocblocksI18nProvider, et as DropdownMenuSub, ft as Checkbox, g as parseFrontmatter, gt as BASELINE_CAPABILITIES, h as mdToBlocks, ht as AlertTitle, i as useEditorContext, in as buttonVariants, it as Separator, j as SelectContent, k as ScrollArea, kt as TEXT_TYPES, l as SHAPE_FONT_STACKS, lt as PopoverHeader, m as insertNative, mt as AlertDescription, n as useCoverAverageColor, nn as EditorErrorBoundary, nt as DropdownMenuSubTrigger, ot as PopoverAnchor, p as htmlToBlocks, pt as Alert, q as DropdownMenuItem, qt as useDoc, r as EditorProvider, rn as Button, rt as DropdownMenuTrigger, st as PopoverContent, t as Editor, tn as createMemoryBlobStore, tt as DropdownMenuSubContent, ut as PopoverTitle, v as markToggleAction, vt as isDatabaseBridge, w as newMutationContext, wt as toBridgeError, x as GridBody, xt as BridgeError, yt as validateProtocolDescriptor, z as SelectValue, zt as CardContent } from "./Editor-CkiRKR-B.mjs";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
3
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
4
|
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-CBPODzZc.mjs";
|
package/dist/mermaid/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { It as Skeleton, Nt as Eye, O as SegmentSelector, Pt as CodeXml, f as textOf, ht as AlertTitle, i as useEditorContext, jt as RotateCcw, mt as AlertDescription, o as childrenSlot, pt as Alert, rn as Button, s as CodeHeader, u as TextBlock, y as INLINE_CODE_CLASS } from "../Editor-
|
|
1
|
+
import { It as Skeleton, Nt as Eye, O as SegmentSelector, Pt as CodeXml, f as textOf, ht as AlertTitle, i as useEditorContext, jt as RotateCcw, mt as AlertDescription, o as childrenSlot, pt as Alert, rn as Button, s as CodeHeader, u as TextBlock, y as INLINE_CODE_CLASS } from "../Editor-CkiRKR-B.mjs";
|
|
2
2
|
import mermaid from "mermaid";
|
|
3
3
|
import { useTranslation } from "react-i18next";
|
|
4
4
|
import { useEffect, useRef, useState } from "react";
|
package/dist/styles.css
CHANGED
|
@@ -754,6 +754,9 @@
|
|
|
754
754
|
.max-h-full {
|
|
755
755
|
max-height: 100%;
|
|
756
756
|
}
|
|
757
|
+
.min-h-\(--docblocks-line-box-height\) {
|
|
758
|
+
min-height: var(--docblocks-line-box-height);
|
|
759
|
+
}
|
|
757
760
|
.min-h-0 {
|
|
758
761
|
min-height: 0px;
|
|
759
762
|
}
|
|
@@ -4141,23 +4144,29 @@
|
|
|
4141
4144
|
/* The empty-block hint: rendered into an empty text block's content box
|
|
4142
4145
|
only while the block holds the caret (the pseudo-element content is not
|
|
4143
4146
|
text content — the input layer and the run rendering ignore it); the
|
|
4144
|
-
attribute carries the provider's placeholder text.
|
|
4147
|
+
attribute carries the provider's placeholder text. The empty page's
|
|
4148
|
+
input stand shows its hint over its :empty stand (the page holds no
|
|
4149
|
+
blocks, so the stand is the page's only affordance — it stands visible
|
|
4150
|
+
before the first focus, inviting the first input). */
|
|
4145
4151
|
[data-slot="docblocks/block-content"]:empty:focus::before,
|
|
4146
|
-
[data-slot="docblocks/block-content"]:empty[data-caret-inside]::before
|
|
4152
|
+
[data-slot="docblocks/block-content"]:empty[data-caret-inside]::before,
|
|
4153
|
+
[data-slot="docblocks/empty-page"]:empty::before {
|
|
4147
4154
|
content: attr(data-placeholder);
|
|
4148
4155
|
color: var(--docblocks-placeholder-color);
|
|
4149
4156
|
pointer-events: none;
|
|
4150
4157
|
}
|
|
4151
4158
|
|
|
4152
|
-
/* The zero-width caret seat: an empty editable (the text block's inner
|
|
4153
|
-
|
|
4159
|
+
/* The zero-width caret seat: an empty editable (the text block's inner, the
|
|
4160
|
+
empty-cell activation layer, and the empty page's input stand) renders a
|
|
4161
|
+
zero-width space while it
|
|
4154
4162
|
stands :empty, so the browser can seat the caret on focus (an empty
|
|
4155
4163
|
contenteditable has no box to take a caret). Structural — a utility
|
|
4156
4164
|
arbitrary-value class cannot carry the CSS escape (the component
|
|
4157
4165
|
source is compiled before the class attribute stands, and the escape
|
|
4158
4166
|
is eaten as a JS octal literal). */
|
|
4159
4167
|
[data-slot="docblocks/block-content"]:empty::after,
|
|
4160
|
-
[data-slot="docblocks/cell-activation"]:empty::after
|
|
4168
|
+
[data-slot="docblocks/cell-activation"]:empty::after,
|
|
4169
|
+
[data-slot="docblocks/empty-page"]:empty::after {
|
|
4161
4170
|
content: "\200b";
|
|
4162
4171
|
}
|
|
4163
4172
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docblocks-react-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"description": "React rendering + editing layer for docblocks: hooks, block renderers, caret/selection, keyboard, clipboard.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"docblocks-core": "^0.
|
|
39
|
+
"docblocks-core": "^0.14.0",
|
|
40
40
|
"framer-motion": "^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0",
|
|
41
41
|
"mermaid": "^12.0.0",
|
|
42
42
|
"pdfjs-dist": "^6.0.0",
|