docblocks-react-ui 0.24.1 → 0.25.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 +35 -0
- package/README.md +50 -25
- package/dist/{Editor-Du_hrZ3E.mjs → Editor-D91f-KD8.mjs} +320 -121
- package/dist/{index-CE8wKsue.d.mts → index-DAc-REs_.d.mts} +54 -3
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +15 -2
- package/dist/mermaid/index.mjs +1 -1
- package/dist/pdf/index.d.mts +1 -1
- package/dist/styles.css +30 -14
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# docblocks-react-ui
|
|
2
2
|
|
|
3
|
+
## 0.25.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b113562: The external-form database grid's header row is resizable: dragging the strip
|
|
8
|
+
over its lower edge sets the height of every header cell at once, with the
|
|
9
|
+
live preview and one commit on the release. The height lands in the block's
|
|
10
|
+
`headerHeight` attr (document data — undoable, synced, restored on reload) or,
|
|
11
|
+
over the `EditorProvider.databaseTableSection` contract, in the consumer's
|
|
12
|
+
per-table value (one height over every block referencing the table; the
|
|
13
|
+
block's own attr wins). The auto height is the drag's floor and read-only
|
|
14
|
+
modes render no handle. The standalone `DatabaseTable` takes the same
|
|
15
|
+
`tableSection` contract.
|
|
16
|
+
- 58dfce7: The published stand's selection policy is the consumer's: the new
|
|
17
|
+
`publishedCopyable` provider prop makes the published snapshot's page text
|
|
18
|
+
selectable and copyable — the `view` mode's parity (the editor's copy
|
|
19
|
+
payload: marks, `@label` mentions, cross-block ranges, the table's grid
|
|
20
|
+
serialization). The default keeps the reader's selection and copy off; the
|
|
21
|
+
canvas world keeps the no-select stand either way.
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 4d8da14: The floating format toolbar never paints over the consumer's chrome above the
|
|
26
|
+
editor: a selection the DOM carries no rect for (the canvas/page switch
|
|
27
|
+
re-seats it over a re-mounted page) keeps the bar's last position instead of
|
|
28
|
+
anchoring off an empty rect, and the bar's own stand never lands above the
|
|
29
|
+
editor root's upper edge.
|
|
30
|
+
- 86d46fa: The column seam at a merged region's interior boundary stands and resizes
|
|
31
|
+
its covered column: a drag over the seam of a column a `colspan` region
|
|
32
|
+
covers commits that column's width (the region's width follows the
|
|
33
|
+
columns' sum). The region's reorder handles stay hidden (the core's
|
|
34
|
+
move/insert guards stand).
|
|
35
|
+
- Updated dependencies [b113562]
|
|
36
|
+
- docblocks-core@0.10.0
|
|
37
|
+
|
|
3
38
|
## 0.24.1
|
|
4
39
|
|
|
5
40
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -97,25 +97,27 @@ slash command is hidden without a bridge; the `sync-embed` block stands
|
|
|
97
97
|
its broken state without a resolver; the `@` stays plain text without a
|
|
98
98
|
mention catalog). The full props list:
|
|
99
99
|
|
|
100
|
-
| Prop | Contract
|
|
101
|
-
| ---------------------------- |
|
|
102
|
-
| `doc` | The core `Doc` to render. Must not change after mount (a throw on change is the contract). Required for the `editor` stand; over the `viewer`'s level the doc IS the published snapshot (the security model — the reader's browser never receives the live document), and an absent stand renders the "not published yet" placeholder.
|
|
103
|
-
| `provider?` | A core `SyncProvider` for the wire + presence. Without it the editor is a single-client document (local edits stand, nothing syncs).
|
|
104
|
-
| `blockRenderers?` | Per-type renderer overrides (see below).
|
|
105
|
-
| `blobStore?` | The blob bridge for image / pdf / file blocks and the document-attributes' cover (see below).
|
|
106
|
-
| `coverPresets?` | The cover's upload modal's preset gallery: the consumer's ready-made cover's file ids (the consumer's blob store's ids) per placement mode — the `tile` / the `center`'s set. A pick commits the id over the mode without an upload (see Blobs below).
|
|
107
|
-
| `databaseBridge?` | The table operations behind external-form database blocks (see below).
|
|
108
|
-
| `
|
|
109
|
-
| `
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
100
|
+
| Prop | Contract |
|
|
101
|
+
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
102
|
+
| `doc` | The core `Doc` to render. Must not change after mount (a throw on change is the contract). Required for the `editor` stand; over the `viewer`'s level the doc IS the published snapshot (the security model — the reader's browser never receives the live document), and an absent stand renders the "not published yet" placeholder. |
|
|
103
|
+
| `provider?` | A core `SyncProvider` for the wire + presence. Without it the editor is a single-client document (local edits stand, nothing syncs). |
|
|
104
|
+
| `blockRenderers?` | Per-type renderer overrides (see below). |
|
|
105
|
+
| `blobStore?` | The blob bridge for image / pdf / file blocks and the document-attributes' cover (see below). |
|
|
106
|
+
| `coverPresets?` | The cover's upload modal's preset gallery: the consumer's ready-made cover's file ids (the consumer's blob store's ids) per placement mode — the `tile` / the `center`'s set. A pick commits the id over the mode without an upload (see Blobs below). |
|
|
107
|
+
| `databaseBridge?` | The table operations behind external-form database blocks (see below). |
|
|
108
|
+
| `databaseTableSection?` | The per-table section settings: `getHeaderHeight(tableId)` + `setHeaderHeight(tableId, height)` (see Database below). The grid reads the header-row height per table; a block's own attr wins over it. |
|
|
109
|
+
| `syncEmbedResolver?` | `(ref) => Doc \| null` — resolves a `sync-embed` block's ref to the master doc (see below). |
|
|
110
|
+
| `embedSandbox?` | `(src) => string \| null` — the embed iframe's `sandbox` policy. The default grants the same-origin (the embedded app's own storage / cookies stand, so the real apps boot); `null` stands no sandbox (a fully trusted embed). Over an untrusted URL stand the `""`'s return (the opaque origin, no scripts); the opaque-origin's restriction stands over this policy. |
|
|
111
|
+
| `pdfPreview?` | A first-page preview component for PDF file blocks (and legacy PDF image blocks). |
|
|
112
|
+
| `mentionProvider?` | The `@` mention picker's search catalog (see below). |
|
|
113
|
+
| `mentionInteractions?` | The mention chip's hover card + the click's delivery (see below). Without the prop the chip stands inert (no card, the click is the browser's stand). |
|
|
114
|
+
| `rootBlockId?` | Render the entry list of this block instead of the document root (the subtree view). Must not change after mount. |
|
|
115
|
+
| `commandPalettePlaceholder?` | The empty-block hint override; the default is localized (en/ru). |
|
|
116
|
+
| `accessLevel?` | The consumer's user access level (default `editor`): `viewer` forces the `published` mode (the current state is never rendered to a reader). |
|
|
117
|
+
| `mode?` | The document mode (default `edit`): `view` is a read-only live document; `published` renders the `publishedDoc` snapshot read-only. |
|
|
118
|
+
| `publishedDoc?` | The published snapshot (a hydrated core `Doc`; must not change after mount — remount over `key` for a new snapshot). The consumer owns the publish action and the snapshot storage. |
|
|
119
|
+
| `publishedCopyable?` | The published stand's selection policy (default `false`): `true` makes the published snapshot's page text selectable and copyable — the `view` mode's parity (the editor's copy payload: marks, `@label` mentions, cross-block ranges, the table's grid serialization); the canvas world keeps the no-select stand. The consumer decides per reader. Session state — never document data. |
|
|
120
|
+
| `presence?` | The local user's presence identity + the selection-sharing cipher (see Presence sharing below). Without the prop the editor keeps the legacy stand (the anonymous plaintext selection, always shared over the room). |
|
|
119
121
|
|
|
120
122
|
Two rules for the optional props:
|
|
121
123
|
|
|
@@ -210,10 +212,14 @@ document data, never on the wire):
|
|
|
210
212
|
ranges); a native table block copies as a spreadsheet's grid (the
|
|
211
213
|
`text/html` flavor is a real `<table>`, the `text/plain` one the TSV —
|
|
212
214
|
the block's own selection copies the whole table). The `published`
|
|
213
|
-
mode stands no selection and no copy (the reader gets the
|
|
214
|
-
only)
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
mode stands no selection and no copy by default (the reader gets the
|
|
216
|
+
rendered page only); the `publishedCopyable` provider prop lifts the
|
|
217
|
+
block per reader — the published page text then stands selectable and
|
|
218
|
+
copyable over the same editor payload as `view`. The canvas world keeps
|
|
219
|
+
the no-select stand in every mode. The editor root carries the resolved
|
|
220
|
+
mode over the `data-mode` attribute (the styling hook; `data-readonly`
|
|
221
|
+
marks both read-only modes, `data-copyable` the copyable published
|
|
222
|
+
stand).
|
|
217
223
|
- Publishing is a consumer action: snapshot the doc state (`doc.encode()`
|
|
218
224
|
or `doc.toJSON()`), persist it where the reader loads it from, and
|
|
219
225
|
hydrate it (`loadDoc` / `fromJSON`) — for the `editor`'s `published`
|
|
@@ -597,6 +603,19 @@ and reorders them by dragging their grips or pressing ArrowUp/ArrowDown on a
|
|
|
597
603
|
focused grip. Header drag and the popover share one full column order, and
|
|
598
604
|
visible column widths follow the moved column.
|
|
599
605
|
|
|
606
|
+
The header row's **height** is adjustable: dragging the lower edge of the
|
|
607
|
+
header row (the full-width strip over its bottom border) sets the height of
|
|
608
|
+
every header cell at once, with the live preview and one commit on the
|
|
609
|
+
release. The drag cannot go below the header's own auto height (the column
|
|
610
|
+
names never render clipped) and stops at a 600 px ceiling. The height has
|
|
611
|
+
two persistence levels: the block's `headerHeight` attr (document data —
|
|
612
|
+
survives the reload, reaches the other participants over the wire, undoes),
|
|
613
|
+
and the table-level value of the consumer's tables section (the
|
|
614
|
+
`databaseTableSection` provider prop, see the props table). A block's own
|
|
615
|
+
attr wins over the table-level value; a block without one follows the table
|
|
616
|
+
and falls back to the auto height. Read-only modes apply the height and
|
|
617
|
+
render no handle.
|
|
618
|
+
|
|
600
619
|
The grid's **Filter** control edits a recursive and/or condition tree: one
|
|
601
620
|
row per condition (the field / the operator / the value over the column's
|
|
602
621
|
annotation, a single line), the nested groups over bordered cards, and the
|
|
@@ -640,7 +659,7 @@ function TablesSection({ bridge }: { bridge: DatabaseBridge }) {
|
|
|
640
659
|
```
|
|
641
660
|
|
|
642
661
|
- `DatabaseTable({ bridge, tableId, readOnly?, view?, onViewChange?,
|
|
643
|
-
className? })` —
|
|
662
|
+
className?, tableSection? })` —
|
|
644
663
|
the live grid over the bridge's table id (the same data stand as the
|
|
645
664
|
document block: the schema, the rows, the live events, the optimistic
|
|
646
665
|
cell layer). The view's settings (`filter`, `columnOrder`,
|
|
@@ -648,7 +667,13 @@ className? })` —
|
|
|
648
667
|
the optional `view` prop at mount); `onViewChange(patch)` receives one
|
|
649
668
|
patch per change for the consumer's persistence (the controlled mode
|
|
650
669
|
stands absent — the state is never external). `readOnly` gates the
|
|
651
|
-
editing's paths (the read-only block's parity).
|
|
670
|
+
editing's paths (the read-only block's parity). `tableSection` is the
|
|
671
|
+
same per-table contract the `EditorProvider` takes: the header row's
|
|
672
|
+
height comes from `getHeaderHeight(tableId)` and the grid's drag commits
|
|
673
|
+
it back over `setHeaderHeight(tableId, height)`, so the section's value and
|
|
674
|
+
the document blocks over the same table stand one height. Without the
|
|
675
|
+
contract the grid renders no header handle (the header keeps the auto
|
|
676
|
+
height). The standalone's grid
|
|
652
677
|
stands no table-name display — the consumer's own visual element (the
|
|
653
678
|
section's list / the heading) stands the name; the document block's
|
|
654
679
|
grid keeps the live name + the rename over it. The sizing's stand is
|
|
@@ -500,7 +500,8 @@ const INIT_OPTIONS = {
|
|
|
500
500
|
"editOptions": "Edit options",
|
|
501
501
|
"show": "Show column",
|
|
502
502
|
"hide": "Hide column",
|
|
503
|
-
"delete": "Delete column"
|
|
503
|
+
"delete": "Delete column",
|
|
504
|
+
"resizeHeight": "Resize the header row"
|
|
504
505
|
},
|
|
505
506
|
row: {
|
|
506
507
|
"moveUp": "Move up",
|
|
@@ -1043,7 +1044,8 @@ const INIT_OPTIONS = {
|
|
|
1043
1044
|
"editOptions": "Изменить варианты",
|
|
1044
1045
|
"show": "Показать столбец",
|
|
1045
1046
|
"hide": "Скрыть столбец",
|
|
1046
|
-
"delete": "Удалить столбец"
|
|
1047
|
+
"delete": "Удалить столбец",
|
|
1048
|
+
"resizeHeight": "Изменить высоту заголовка"
|
|
1047
1049
|
},
|
|
1048
1050
|
row: {
|
|
1049
1051
|
"moveUp": "Переместить вверх",
|
|
@@ -8545,6 +8547,77 @@ function AddColumnForm({ open, onOpenChange, form, formNumber, formRef, error, b
|
|
|
8545
8547
|
});
|
|
8546
8548
|
}
|
|
8547
8549
|
//#endregion
|
|
8550
|
+
//#region src/database/grid/column-type-icon.ts
|
|
8551
|
+
function columnTypeIcon(type, refKind, refMany) {
|
|
8552
|
+
if (refKind === "enum") return refMany ? ListChecks : CircleChevronDown;
|
|
8553
|
+
if (refKind === "row") return Cable;
|
|
8554
|
+
if (type === "integer" || type === "numeric") return Hash;
|
|
8555
|
+
if (type === "boolean") return CircleCheck;
|
|
8556
|
+
if (type === "date") return CalendarIcon;
|
|
8557
|
+
if (type === "timestamptz") return CalendarClock;
|
|
8558
|
+
return Type;
|
|
8559
|
+
}
|
|
8560
|
+
//#endregion
|
|
8561
|
+
//#region src/database/grid/AddColumnCell.tsx
|
|
8562
|
+
/** The grid's header-row "add column" cell: the plus chip (the type's menu)
|
|
8563
|
+
* and the create form over it. The cell carries its own explicit grid
|
|
8564
|
+
* placement (the header row's track after the last column) — the header's
|
|
8565
|
+
* resize strip occupies the same row across all tracks. The read-only
|
|
8566
|
+
* modes render the empty track (the primitive's stand: no chip, no form). */
|
|
8567
|
+
function AddColumnCell({ gridColumn, readOnly, form, OptionsEditor }) {
|
|
8568
|
+
const { t } = useTranslation("database");
|
|
8569
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
8570
|
+
"data-slot": "docblocks/database-add-column",
|
|
8571
|
+
className: "\n relative row-start-1 flex items-center justify-center border-b-(length:--docblocks-table-border-width)\n border-(--docblocks-table-border-color)\n ",
|
|
8572
|
+
style: { gridColumn },
|
|
8573
|
+
children: [!readOnly && /* @__PURE__ */ jsxs(DropdownMenu, {
|
|
8574
|
+
modal: false,
|
|
8575
|
+
open: form.addingColumn,
|
|
8576
|
+
onOpenChange: form.setAddingColumn,
|
|
8577
|
+
children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
8578
|
+
asChild: true,
|
|
8579
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
8580
|
+
"data-slot": "docblocks/database-add-column-trigger",
|
|
8581
|
+
variant: "ghost",
|
|
8582
|
+
size: "icon",
|
|
8583
|
+
className: cn("rounded-(--docblocks-radius) border-(length:--docblocks-table-border-width) border-(--docblocks-table-border-color) bg-transparent dark:border-(--docblocks-table-border-color) dark:bg-transparent", "size-6 cursor-pointer p-1 text-(--docblocks-placeholder-color) hover:bg-transparent", "hover:text-(--docblocks-text-color) dark:hover:bg-transparent"),
|
|
8584
|
+
children: /* @__PURE__ */ jsx(Plus, { className: "size-4" })
|
|
8585
|
+
})
|
|
8586
|
+
}), /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
8587
|
+
align: "end",
|
|
8588
|
+
className: "min-w-32",
|
|
8589
|
+
children: ADD_COLUMN_TYPES.map((entry) => {
|
|
8590
|
+
const EntryIcon = columnTypeIcon(entry.type, entry.refKind, entry.refMany);
|
|
8591
|
+
return /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
8592
|
+
"data-column-entry": entry.key,
|
|
8593
|
+
onClick: () => form.openCreateForm(entry),
|
|
8594
|
+
children: [/* @__PURE__ */ jsx(EntryIcon, { className: "size-4 shrink-0 text-muted-foreground" }), t(entry.labelKey)]
|
|
8595
|
+
}, entry.key);
|
|
8596
|
+
})
|
|
8597
|
+
})]
|
|
8598
|
+
}), /* @__PURE__ */ jsx(AddColumnForm, {
|
|
8599
|
+
open: form.columnFormOpen,
|
|
8600
|
+
onOpenChange: form.onColumnFormOpenChange,
|
|
8601
|
+
form: form.columnForm,
|
|
8602
|
+
formNumber: form.columnFormNumber,
|
|
8603
|
+
formRef: form.columnFormRef,
|
|
8604
|
+
error: form.columnFormError,
|
|
8605
|
+
bridgeTables: form.bridgeTables,
|
|
8606
|
+
OptionsEditor,
|
|
8607
|
+
onCommit: form.commitColumnForm,
|
|
8608
|
+
onNameChange: form.onColumnNameChange,
|
|
8609
|
+
onDecimalsChange: form.onColumnDecimalsChange,
|
|
8610
|
+
onThousandsChange: form.onColumnThousandsChange,
|
|
8611
|
+
onPrefixChange: form.onColumnPrefixChange,
|
|
8612
|
+
onSuffixChange: form.onColumnSuffixChange,
|
|
8613
|
+
onAllowNegativeChange: form.onColumnAllowNegativeChange,
|
|
8614
|
+
onEnumOptionsChange: form.onColumnEnumOptionsChange,
|
|
8615
|
+
onRefPickChange: form.onColumnRefPickChange,
|
|
8616
|
+
onNewTableNameChange: form.onColumnNewTableNameChange
|
|
8617
|
+
})]
|
|
8618
|
+
});
|
|
8619
|
+
}
|
|
8620
|
+
//#endregion
|
|
8548
8621
|
//#region src/database/grid/cells/CellDisplay.tsx
|
|
8549
8622
|
/** The cell's read-only display (the single-press stand: the value text or
|
|
8550
8623
|
* the empty stand). */
|
|
@@ -9659,17 +9732,6 @@ function GridRows({ rows, columns, data, selectedCells, editingCell, setEditingC
|
|
|
9659
9732
|
] });
|
|
9660
9733
|
}
|
|
9661
9734
|
//#endregion
|
|
9662
|
-
//#region src/database/grid/column-type-icon.ts
|
|
9663
|
-
function columnTypeIcon(type, refKind, refMany) {
|
|
9664
|
-
if (refKind === "enum") return refMany ? ListChecks : CircleChevronDown;
|
|
9665
|
-
if (refKind === "row") return Cable;
|
|
9666
|
-
if (type === "integer" || type === "numeric") return Hash;
|
|
9667
|
-
if (type === "boolean") return CircleCheck;
|
|
9668
|
-
if (type === "date") return CalendarIcon;
|
|
9669
|
-
if (type === "timestamptz") return CalendarClock;
|
|
9670
|
-
return Type;
|
|
9671
|
-
}
|
|
9672
|
-
//#endregion
|
|
9673
9735
|
//#region src/database/grid/HeaderCell.tsx
|
|
9674
9736
|
/** The grid's header cell (the column's name + the press menu + the
|
|
9675
9737
|
* right-edge resize seam). */
|
|
@@ -9683,6 +9745,12 @@ function HeaderCell({ readOnly = false, column, colIndex, first, resizing, dragD
|
|
|
9683
9745
|
const { t } = useTranslation("database");
|
|
9684
9746
|
const [nameDraft, setNameDraft] = useState(column.name);
|
|
9685
9747
|
const ColumnIcon = columnTypeIcon(column.type, column.refKind, column.refMany);
|
|
9748
|
+
const dragStyle = dragDx !== 0 ? {
|
|
9749
|
+
transform: `translateX(${dragDx}px)`,
|
|
9750
|
+
position: "relative",
|
|
9751
|
+
zIndex: dragShifted ? void 0 : 10,
|
|
9752
|
+
transition: dragShifted ? GRID_DRAG_TRANSITION : void 0
|
|
9753
|
+
} : null;
|
|
9686
9754
|
const commitRename = () => {
|
|
9687
9755
|
const trimmed = nameDraft.trim();
|
|
9688
9756
|
if (trimmed !== "" && trimmed !== column.name) onRename(trimmed);
|
|
@@ -9709,12 +9777,11 @@ function HeaderCell({ readOnly = false, column, colIndex, first, resizing, dragD
|
|
|
9709
9777
|
return /* @__PURE__ */ jsxs("div", {
|
|
9710
9778
|
"data-slot": "docblocks/database-header-cell",
|
|
9711
9779
|
"data-column-id": column.id,
|
|
9712
|
-
style:
|
|
9713
|
-
|
|
9714
|
-
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
} : void 0,
|
|
9780
|
+
style: {
|
|
9781
|
+
gridRow: 1,
|
|
9782
|
+
gridColumn: colIndex + 1,
|
|
9783
|
+
...dragStyle
|
|
9784
|
+
},
|
|
9718
9785
|
className: cn(`
|
|
9719
9786
|
relative flex min-w-0 items-center gap-1 border-b-(length:--docblocks-table-border-width)
|
|
9720
9787
|
border-(--docblocks-table-border-color) bg-muted/40 px-2 py-1 select-none
|
|
@@ -9804,6 +9871,38 @@ function HeaderCell({ readOnly = false, column, colIndex, first, resizing, dragD
|
|
|
9804
9871
|
});
|
|
9805
9872
|
}
|
|
9806
9873
|
//#endregion
|
|
9874
|
+
//#region src/database/grid/HeaderResizeHandle.tsx
|
|
9875
|
+
/** The grid's header-row resize handle: the full-width strip over the
|
|
9876
|
+
* header row's bottom edge (it spans the header's track row — the header
|
|
9877
|
+
* cells carry their own explicit placement, so the strip stands the
|
|
9878
|
+
* overlay of the same row). The press-drag session is the hook's stand;
|
|
9879
|
+
* the read-only modes render no handle (the height itself still
|
|
9880
|
+
* applies). */
|
|
9881
|
+
/** The header's bottom edge: the 6 px strip straddles the border (the
|
|
9882
|
+
* seam idiom — the pointer over the edge stands the stable row-resize). */
|
|
9883
|
+
function HeaderResizeHandle({ resizing, onPointerDown, onPointerMove, onPointerUp, onPointerCancel }) {
|
|
9884
|
+
const { t } = useTranslation("database");
|
|
9885
|
+
return /* @__PURE__ */ jsx("div", {
|
|
9886
|
+
role: "separator",
|
|
9887
|
+
"aria-orientation": "horizontal",
|
|
9888
|
+
"aria-label": t("header.resizeHeight"),
|
|
9889
|
+
"data-slot": "docblocks/database-header-resize",
|
|
9890
|
+
className: cn(`
|
|
9891
|
+
z-10 col-span-full row-start-1 flex h-1.5 translate-y-1/2 cursor-row-resize items-center self-end opacity-0
|
|
9892
|
+
transition-opacity
|
|
9893
|
+
hover:opacity-100
|
|
9894
|
+
`, resizing && "opacity-100"),
|
|
9895
|
+
onPointerDown,
|
|
9896
|
+
onPointerMove,
|
|
9897
|
+
onPointerUp,
|
|
9898
|
+
onPointerCancel,
|
|
9899
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
9900
|
+
"data-slot": "docblocks/database-header-resize-line",
|
|
9901
|
+
className: "h-0.5 w-full rounded bg-(--muted-foreground)"
|
|
9902
|
+
})
|
|
9903
|
+
});
|
|
9904
|
+
}
|
|
9905
|
+
//#endregion
|
|
9807
9906
|
//#region src/database/grid/use-grid-column-drag.ts
|
|
9808
9907
|
/** The database grid's column drag: the header cell's press + drag (the
|
|
9809
9908
|
* live parting preview — the dragged column's own cells stand the pointer's
|
|
@@ -9889,6 +9988,99 @@ function useGridColumnDrag({ columns, allColumns, columnOrder, hiddenColumns, co
|
|
|
9889
9988
|
};
|
|
9890
9989
|
}
|
|
9891
9990
|
//#endregion
|
|
9991
|
+
//#region src/database/grid/header-height.ts
|
|
9992
|
+
/** The grid's header-row height stands: the resolution over the two
|
|
9993
|
+
* persistence levels (the block's own attr over the consumer's per-table
|
|
9994
|
+
* section value, an absent stand = the auto height), the drag's clamp, and
|
|
9995
|
+
* the auto height's live measurement. */
|
|
9996
|
+
/** The header row's height stand: the block's own attr wins over the
|
|
9997
|
+
* table section's value (the consumer's per-table persistence — the same
|
|
9998
|
+
* height over every block referencing the table); an absent stand keeps
|
|
9999
|
+
* the auto height. */
|
|
10000
|
+
function resolveDatabaseHeaderHeight(blockHeight, sectionHeight) {
|
|
10001
|
+
return blockHeight ?? sectionHeight;
|
|
10002
|
+
}
|
|
10003
|
+
/** The drag's clamp: the auto height is the floor (the column names never
|
|
10004
|
+
* render clipped), with the one-line fallback floor when the auto height
|
|
10005
|
+
* stands unmeasured; the ceiling is the drag's generous bound (the data
|
|
10006
|
+
* level checks the positivity only). */
|
|
10007
|
+
function clampDatabaseHeaderHeight(requested, natural) {
|
|
10008
|
+
return Math.max(Math.max(Math.round(natural), 28), Math.min(Math.round(requested), 600));
|
|
10009
|
+
}
|
|
10010
|
+
/** The header row's natural (auto) height in px, measured over the live
|
|
10011
|
+
* grid: the explicit track's height is lifted for the read and restored
|
|
10012
|
+
* before the frame paints, so the returned stand is the content's own.
|
|
10013
|
+
* A detached / unlaid-out grid (no layout in the runtime) stands 0. */
|
|
10014
|
+
function measureDatabaseHeaderHeight(grid) {
|
|
10015
|
+
if (grid === null) return 0;
|
|
10016
|
+
const previous = grid.style.gridTemplateRows;
|
|
10017
|
+
grid.style.gridTemplateRows = "auto";
|
|
10018
|
+
let natural = 0;
|
|
10019
|
+
for (const cell of grid.querySelectorAll("[data-slot=\"docblocks/database-header-cell\"]")) natural = Math.max(natural, cell.offsetHeight);
|
|
10020
|
+
grid.style.gridTemplateRows = previous;
|
|
10021
|
+
return natural;
|
|
10022
|
+
}
|
|
10023
|
+
//#endregion
|
|
10024
|
+
//#region src/database/grid/use-grid-header-resize.ts
|
|
10025
|
+
/** The database grid's header-row resize: the full-width handle's press +
|
|
10026
|
+
* drag (the live preview stands the row's height; no commit until the
|
|
10027
|
+
* release), the release (the clamped height commits over the caller's
|
|
10028
|
+
* write stand — the block's attr / the consumer's per-table section
|
|
10029
|
+
* setting; a drag back to the press's height stands a no-op), and the
|
|
10030
|
+
* cancel. The clamp's floor is the auto height measured at the press, so
|
|
10031
|
+
* the header's content never renders clipped. */
|
|
10032
|
+
function useGridHeaderResize({ tableRef, headerHeight, onCommit }) {
|
|
10033
|
+
const [headerPreview, setHeaderPreview] = useState(null);
|
|
10034
|
+
const session = useRef(null);
|
|
10035
|
+
/** The handle's press: starts the resize session (the native click /
|
|
10036
|
+
* the surrounding gestures are suppressed — the handle stands its own
|
|
10037
|
+
* session). */
|
|
10038
|
+
const onHeaderPointerDown = (event) => {
|
|
10039
|
+
if (event.button !== 0 || session.current !== null) return;
|
|
10040
|
+
event.preventDefault();
|
|
10041
|
+
event.stopPropagation();
|
|
10042
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
10043
|
+
const natural = measureDatabaseHeaderHeight(tableRef.current);
|
|
10044
|
+
const startHeight = clampDatabaseHeaderHeight(headerHeight ?? Math.max(natural, 28), natural);
|
|
10045
|
+
session.current = {
|
|
10046
|
+
startY: event.clientY,
|
|
10047
|
+
startHeight,
|
|
10048
|
+
natural,
|
|
10049
|
+
height: startHeight
|
|
10050
|
+
};
|
|
10051
|
+
setHeaderPreview(startHeight);
|
|
10052
|
+
};
|
|
10053
|
+
const onHeaderPointerMove = (event) => {
|
|
10054
|
+
const live = session.current;
|
|
10055
|
+
if (live === null) return;
|
|
10056
|
+
live.height = clampDatabaseHeaderHeight(live.startHeight + (event.clientY - live.startY), live.natural);
|
|
10057
|
+
setHeaderPreview(live.height);
|
|
10058
|
+
};
|
|
10059
|
+
/** The handle's release: the clamped height commits when it changed (one
|
|
10060
|
+
* write, one undo step over the block's stand); a drag back to the
|
|
10061
|
+
* press's height stands a no-op (no wire traffic). */
|
|
10062
|
+
const onHeaderPointerUp = (event) => {
|
|
10063
|
+
const live = session.current;
|
|
10064
|
+
session.current = null;
|
|
10065
|
+
setHeaderPreview(null);
|
|
10066
|
+
if (live === null) return;
|
|
10067
|
+
event.currentTarget.releasePointerCapture?.(event.pointerId);
|
|
10068
|
+
if (live.height === live.startHeight) return;
|
|
10069
|
+
onCommit(live.height);
|
|
10070
|
+
};
|
|
10071
|
+
const onHeaderPointerCancel = () => {
|
|
10072
|
+
session.current = null;
|
|
10073
|
+
setHeaderPreview(null);
|
|
10074
|
+
};
|
|
10075
|
+
return {
|
|
10076
|
+
headerPreview,
|
|
10077
|
+
onHeaderPointerDown,
|
|
10078
|
+
onHeaderPointerMove,
|
|
10079
|
+
onHeaderPointerUp,
|
|
10080
|
+
onHeaderPointerCancel
|
|
10081
|
+
};
|
|
10082
|
+
}
|
|
10083
|
+
//#endregion
|
|
9892
10084
|
//#region src/database/grid/use-grid-seam-resize.ts
|
|
9893
10085
|
/** The database grid's column-seam resize: the header cell's right-edge
|
|
9894
10086
|
* seam's press + drag (the live preview locks every column over its
|
|
@@ -9989,8 +10181,7 @@ function useGridSeamResize({ columns, columnWidths, updateView }) {
|
|
|
9989
10181
|
* model (the cell / column selection — the native text selection over the
|
|
9990
10182
|
* drag is suppressed).
|
|
9991
10183
|
*/
|
|
9992
|
-
function GridTable({ columns, allColumns, columnOrder, hiddenColumns, columnWidths, onViewChange, data, rows, selectedCells, editingCell, setEditingCell, onCellPointerDown, booleanPressRef, pendingRowId, refTableData, filter, readOnly = false, tableRef, onTableKeyDown, onTablePaste, onTableBlur, form, OptionsEditor }) {
|
|
9993
|
-
const { t } = useTranslation("database");
|
|
10184
|
+
function GridTable({ columns, allColumns, columnOrder, hiddenColumns, columnWidths, onViewChange, data, rows, selectedCells, editingCell, setEditingCell, onCellPointerDown, booleanPressRef, pendingRowId, refTableData, filter, readOnly = false, headerHeight, onHeaderHeightChange, tableRef, onTableKeyDown, onTablePaste, onTableBlur, form, OptionsEditor }) {
|
|
9994
10185
|
const [columnMenu, setColumnMenu] = useState(null);
|
|
9995
10186
|
const { resizePreview, onSeamPointerDown, onSeamPointerMove, onSeamPointerUp, onSeamPointerCancel } = useGridSeamResize({
|
|
9996
10187
|
columns,
|
|
@@ -10006,6 +10197,12 @@ function GridTable({ columns, allColumns, columnOrder, hiddenColumns, columnWidt
|
|
|
10006
10197
|
updateView: onViewChange,
|
|
10007
10198
|
tableRef
|
|
10008
10199
|
});
|
|
10200
|
+
const { headerPreview, onHeaderPointerDown, onHeaderPointerMove, onHeaderPointerUp, onHeaderPointerCancel } = useGridHeaderResize({
|
|
10201
|
+
tableRef,
|
|
10202
|
+
headerHeight,
|
|
10203
|
+
onCommit: onHeaderHeightChange ?? (() => void 0)
|
|
10204
|
+
});
|
|
10205
|
+
const headerRowHeight = headerPreview ?? headerHeight;
|
|
10009
10206
|
const dragFrom = drag === null ? -1 : columns.findIndex((entry) => entry.id === drag.id);
|
|
10010
10207
|
const dragShiftOf = (index) => {
|
|
10011
10208
|
if (drag === null || drag.toIndex === null || index === dragFrom) return 0;
|
|
@@ -10039,7 +10236,7 @@ function GridTable({ columns, allColumns, columnOrder, hiddenColumns, columnWidt
|
|
|
10039
10236
|
onPaste: onTablePaste,
|
|
10040
10237
|
onBlur: onTableBlur,
|
|
10041
10238
|
style: {
|
|
10042
|
-
gridTemplateRows: "auto",
|
|
10239
|
+
gridTemplateRows: headerRowHeight !== void 0 ? `${headerRowHeight}px` : "auto",
|
|
10043
10240
|
gridAutoRows: "var(--docblocks-database-row-height)",
|
|
10044
10241
|
gridTemplateColumns: `${columns.map((_, index) => {
|
|
10045
10242
|
const width = (resizePreview !== null ? resizePreview.widths[index] : void 0) ?? columnWidths?.[index];
|
|
@@ -10071,54 +10268,18 @@ function GridTable({ columns, allColumns, columnOrder, hiddenColumns, columnWidt
|
|
|
10071
10268
|
onPointerMove: onColumnPointerMove,
|
|
10072
10269
|
onPointerUp: columnPointerUp(column)
|
|
10073
10270
|
}, column.id)),
|
|
10074
|
-
/* @__PURE__ */
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
|
|
10083
|
-
|
|
10084
|
-
|
|
10085
|
-
|
|
10086
|
-
size: "icon",
|
|
10087
|
-
className: cn("rounded-(--docblocks-radius) border-(length:--docblocks-table-border-width) border-(--docblocks-table-border-color) bg-transparent dark:border-(--docblocks-table-border-color) dark:bg-transparent", "size-6 cursor-pointer p-1 text-(--docblocks-placeholder-color) hover:bg-transparent", "hover:text-(--docblocks-text-color) dark:hover:bg-transparent"),
|
|
10088
|
-
children: /* @__PURE__ */ jsx(Plus, { className: "size-4" })
|
|
10089
|
-
})
|
|
10090
|
-
}), /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
10091
|
-
align: "end",
|
|
10092
|
-
className: "min-w-32",
|
|
10093
|
-
children: ADD_COLUMN_TYPES.map((entry) => {
|
|
10094
|
-
const EntryIcon = columnTypeIcon(entry.type, entry.refKind, entry.refMany);
|
|
10095
|
-
return /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
10096
|
-
"data-column-entry": entry.key,
|
|
10097
|
-
onClick: () => form.openCreateForm(entry),
|
|
10098
|
-
children: [/* @__PURE__ */ jsx(EntryIcon, { className: "size-4 shrink-0 text-muted-foreground" }), t(entry.labelKey)]
|
|
10099
|
-
}, entry.key);
|
|
10100
|
-
})
|
|
10101
|
-
})]
|
|
10102
|
-
}), /* @__PURE__ */ jsx(AddColumnForm, {
|
|
10103
|
-
open: form.columnFormOpen,
|
|
10104
|
-
onOpenChange: form.onColumnFormOpenChange,
|
|
10105
|
-
form: form.columnForm,
|
|
10106
|
-
formNumber: form.columnFormNumber,
|
|
10107
|
-
formRef: form.columnFormRef,
|
|
10108
|
-
error: form.columnFormError,
|
|
10109
|
-
bridgeTables: form.bridgeTables,
|
|
10110
|
-
OptionsEditor,
|
|
10111
|
-
onCommit: form.commitColumnForm,
|
|
10112
|
-
onNameChange: form.onColumnNameChange,
|
|
10113
|
-
onDecimalsChange: form.onColumnDecimalsChange,
|
|
10114
|
-
onThousandsChange: form.onColumnThousandsChange,
|
|
10115
|
-
onPrefixChange: form.onColumnPrefixChange,
|
|
10116
|
-
onSuffixChange: form.onColumnSuffixChange,
|
|
10117
|
-
onAllowNegativeChange: form.onColumnAllowNegativeChange,
|
|
10118
|
-
onEnumOptionsChange: form.onColumnEnumOptionsChange,
|
|
10119
|
-
onRefPickChange: form.onColumnRefPickChange,
|
|
10120
|
-
onNewTableNameChange: form.onColumnNewTableNameChange
|
|
10121
|
-
})]
|
|
10271
|
+
!readOnly && onHeaderHeightChange !== void 0 && /* @__PURE__ */ jsx(HeaderResizeHandle, {
|
|
10272
|
+
resizing: headerPreview !== null,
|
|
10273
|
+
onPointerDown: onHeaderPointerDown,
|
|
10274
|
+
onPointerMove: onHeaderPointerMove,
|
|
10275
|
+
onPointerUp: onHeaderPointerUp,
|
|
10276
|
+
onPointerCancel: onHeaderPointerCancel
|
|
10277
|
+
}),
|
|
10278
|
+
/* @__PURE__ */ jsx(AddColumnCell, {
|
|
10279
|
+
gridColumn: columns.length + 1,
|
|
10280
|
+
readOnly,
|
|
10281
|
+
form,
|
|
10282
|
+
OptionsEditor
|
|
10122
10283
|
}),
|
|
10123
10284
|
/* @__PURE__ */ jsx(GridRows, {
|
|
10124
10285
|
rows,
|
|
@@ -11190,7 +11351,7 @@ function useGridPendingRow({ pendingRow, data, columns, tableRef, setEditingCell
|
|
|
11190
11351
|
* toolbar over `GridToolbar`, the table over `GridTable` (+ `GridRows`),
|
|
11191
11352
|
* the pending row's lifecycle over `use-grid-pending-row`, the state's
|
|
11192
11353
|
* surfaces over `GridStateCards`. */
|
|
11193
|
-
function GridBody({ blockId, bridge, tableId, filter, columnOrder, hiddenColumns, columnWidths, onViewChange, readColumnOrder, readOnly = false }) {
|
|
11354
|
+
function GridBody({ blockId, bridge, tableId, filter, columnOrder, hiddenColumns, columnWidths, headerHeight, sectionHeaderHeight, onHeaderHeightChange, onViewChange, readColumnOrder, readOnly = false }) {
|
|
11194
11355
|
const { t } = useTranslation("database");
|
|
11195
11356
|
const data = useDatabaseTable(bridge, tableId, filter);
|
|
11196
11357
|
const tableRef = useRef(null);
|
|
@@ -11216,6 +11377,7 @@ function GridBody({ blockId, bridge, tableId, filter, columnOrder, hiddenColumns
|
|
|
11216
11377
|
onViewChange
|
|
11217
11378
|
});
|
|
11218
11379
|
const columns = visibleColumns(data.table?.columns, columnOrder, hiddenColumns);
|
|
11380
|
+
const resolvedHeaderHeight = resolveDatabaseHeaderHeight(headerHeight, sectionHeaderHeight);
|
|
11219
11381
|
const updateView = (patch) => {
|
|
11220
11382
|
onViewChange(patch);
|
|
11221
11383
|
};
|
|
@@ -11288,6 +11450,8 @@ function GridBody({ blockId, bridge, tableId, filter, columnOrder, hiddenColumns
|
|
|
11288
11450
|
refTableData,
|
|
11289
11451
|
filter,
|
|
11290
11452
|
readOnly,
|
|
11453
|
+
headerHeight: resolvedHeaderHeight,
|
|
11454
|
+
onHeaderHeightChange,
|
|
11291
11455
|
tableRef,
|
|
11292
11456
|
onTableKeyDown,
|
|
11293
11457
|
onTablePaste,
|
|
@@ -11363,7 +11527,7 @@ function DatabaseDisconnected({ name }) {
|
|
|
11363
11527
|
});
|
|
11364
11528
|
}
|
|
11365
11529
|
function DatabaseGrid({ id, block }) {
|
|
11366
|
-
const { doc, databaseBridge, viewMode } = useEditorContext();
|
|
11530
|
+
const { doc, databaseBridge, databaseTableSection, viewMode } = useEditorContext();
|
|
11367
11531
|
const tableId = block.attrs.tableId;
|
|
11368
11532
|
if (tableId === void 0) return null;
|
|
11369
11533
|
if (databaseBridge === void 0) return /* @__PURE__ */ jsx(DatabaseDisconnected, { name: block.attrs.name });
|
|
@@ -11375,6 +11539,9 @@ function DatabaseGrid({ id, block }) {
|
|
|
11375
11539
|
columnOrder: block.attrs.columnOrder,
|
|
11376
11540
|
hiddenColumns: block.attrs.hiddenColumns,
|
|
11377
11541
|
columnWidths: block.attrs.columnWidths,
|
|
11542
|
+
headerHeight: block.attrs.headerHeight,
|
|
11543
|
+
sectionHeaderHeight: databaseTableSection?.getHeaderHeight?.(tableId),
|
|
11544
|
+
onHeaderHeightChange: (height) => doc.updateBlock(id, { headerHeight: height }),
|
|
11378
11545
|
onViewChange: (patch) => doc.updateBlock(id, patch),
|
|
11379
11546
|
readColumnOrder: () => {
|
|
11380
11547
|
const current = doc.getBlock(id);
|
|
@@ -24224,7 +24391,7 @@ const openLinkHref = (href) => {
|
|
|
24224
24391
|
* handler (the link's anchor's stand — the native menu's suppress over the
|
|
24225
24392
|
* link's own menu; the other's targets stand the native's stand). */
|
|
24226
24393
|
/** The selection's rect's bottom to the popover's anchor's gap (px). */
|
|
24227
|
-
const ANCHOR_GAP_PX = 8;
|
|
24394
|
+
const ANCHOR_GAP_PX$1 = 8;
|
|
24228
24395
|
/** The selection's reseat's window (the tracking's transient mapping's
|
|
24229
24396
|
* suppression over the popover / the menu's open's input's focus and the
|
|
24230
24397
|
* close's residue — the doc's selection's no-clobber's stand). */
|
|
@@ -24301,7 +24468,7 @@ function useLinkPopover(rootRef) {
|
|
|
24301
24468
|
const rootRect = root.getBoundingClientRect();
|
|
24302
24469
|
anchor = {
|
|
24303
24470
|
x: rect.left + rect.width / 2 - rootRect.left,
|
|
24304
|
-
y: rect.bottom - rootRect.top + ANCHOR_GAP_PX
|
|
24471
|
+
y: rect.bottom - rootRect.top + ANCHOR_GAP_PX$1
|
|
24305
24472
|
};
|
|
24306
24473
|
}
|
|
24307
24474
|
open(anchor, { target });
|
|
@@ -24661,6 +24828,39 @@ function createFormatToolbarActions({ doc, range, single, target, rootRef, onPal
|
|
|
24661
24828
|
};
|
|
24662
24829
|
}
|
|
24663
24830
|
//#endregion
|
|
24831
|
+
//#region src/editing/format-toolbar/format-toolbar-anchor.ts
|
|
24832
|
+
/** The format bar's anchoring: the placement over the selection's rect and
|
|
24833
|
+
* the root's stand. */
|
|
24834
|
+
/** The bar's inset from the editor root's edges and the selection's rect. */
|
|
24835
|
+
const ANCHOR_GAP_PX = 8;
|
|
24836
|
+
/** The upper room below which the bar stands under the selection. */
|
|
24837
|
+
const ABOVE_MIN_ROOM_PX = 4;
|
|
24838
|
+
/**
|
|
24839
|
+
* Places the bar above the selection's rect (below it when the upper room
|
|
24840
|
+
* is short) and never above the editor root's upper edge: the consumer's own
|
|
24841
|
+
* chrome stands there, and the bar is the editor's surface (it legitimately
|
|
24842
|
+
* overhangs the content's bottom — no chrome below). A model range the DOM
|
|
24843
|
+
* carries no rect for (the canvas/page switch re-seats the selection over a
|
|
24844
|
+
* re-mounted page, a parked focus) keeps the bar's last position: an empty
|
|
24845
|
+
* rect is no anchor, and its page-origin stand would put the bar over the
|
|
24846
|
+
* chrome above the editor. The unit runtime has no range geometry — the bar
|
|
24847
|
+
* keeps its default position there.
|
|
24848
|
+
*/
|
|
24849
|
+
function anchorFormatToolbar(el, root) {
|
|
24850
|
+
if (typeof Range.prototype.getBoundingClientRect !== "function") return;
|
|
24851
|
+
const selection = window.getSelection();
|
|
24852
|
+
if (selection === null || selection.rangeCount === 0 || !root.contains(selection.anchorNode)) return;
|
|
24853
|
+
const rect = selection.getRangeAt(0).getBoundingClientRect();
|
|
24854
|
+
if (rect.width === 0 && rect.height === 0) return;
|
|
24855
|
+
const rootRect = root.getBoundingClientRect();
|
|
24856
|
+
const width = el.offsetWidth;
|
|
24857
|
+
const height = el.offsetHeight;
|
|
24858
|
+
const above = rect.top - rootRect.top - height - ANCHOR_GAP_PX;
|
|
24859
|
+
const top = above < ABOVE_MIN_ROOM_PX ? rect.bottom - rootRect.top + ANCHOR_GAP_PX : above;
|
|
24860
|
+
el.style.left = `${clamp(rect.left + rect.width / 2 - width / 2 - rootRect.left, ANCHOR_GAP_PX, Math.max(ANCHOR_GAP_PX, rootRect.width - width - ANCHOR_GAP_PX))}px`;
|
|
24861
|
+
el.style.top = `${Math.max(top, ANCHOR_GAP_PX)}px`;
|
|
24862
|
+
}
|
|
24863
|
+
//#endregion
|
|
24664
24864
|
//#region src/editing/format-toolbar/FormatToolbar.tsx
|
|
24665
24865
|
/** The floating format toolbar — the selection's formatting affordance.
|
|
24666
24866
|
*
|
|
@@ -24672,7 +24872,10 @@ function createFormatToolbarActions({ doc, range, single, target, rootRef, onPal
|
|
|
24672
24872
|
* (below it when there is no room above) and disappears as soon as the
|
|
24673
24873
|
* selection collapses, leaves the target, or becomes a blocks selection —
|
|
24674
24874
|
* the visibility is derived from the selection state, so no key or mouse
|
|
24675
|
-
* capture is needed.
|
|
24875
|
+
* capture is needed. A model range the DOM carries no rect for (the
|
|
24876
|
+
* canvas/page switch re-seats the selection over a re-mounted page) keeps the
|
|
24877
|
+
* bar's last position — never the page origin's stand above the editor's own
|
|
24878
|
+
* box, over the consumer's chrome.
|
|
24676
24879
|
*
|
|
24677
24880
|
* Controls (shared/ui primitives): the five toggle marks (bold, monospace
|
|
24678
24881
|
* = the exclusive code mark, italic, underline, strikethrough) and the
|
|
@@ -24705,20 +24908,7 @@ function FormatToolbar({ rootRef, palette }) {
|
|
|
24705
24908
|
const el = barRef.current;
|
|
24706
24909
|
const root = rootRef.current;
|
|
24707
24910
|
if (el === null || root === null) return;
|
|
24708
|
-
|
|
24709
|
-
if (domSelection === null || domSelection.rangeCount === 0) return;
|
|
24710
|
-
if (!root.contains(domSelection.anchorNode)) return;
|
|
24711
|
-
const range = domSelection.getRangeAt(0);
|
|
24712
|
-
if (typeof range.getBoundingClientRect !== "function") return;
|
|
24713
|
-
const rect = range.getBoundingClientRect();
|
|
24714
|
-
const rootRect = root.getBoundingClientRect();
|
|
24715
|
-
const width = el.offsetWidth;
|
|
24716
|
-
const height = el.offsetHeight;
|
|
24717
|
-
const left = clamp(rect.left + rect.width / 2 - width / 2 - rootRect.left, 8, Math.max(8, rootRect.width - width - 8));
|
|
24718
|
-
const above = rect.top - rootRect.top - height - 8;
|
|
24719
|
-
const top = above < 4 ? rect.bottom - rootRect.top + 8 : above;
|
|
24720
|
-
el.style.left = `${left}px`;
|
|
24721
|
-
el.style.top = `${top}px`;
|
|
24911
|
+
anchorFormatToolbar(el, root);
|
|
24722
24912
|
});
|
|
24723
24913
|
if (range === null) return null;
|
|
24724
24914
|
if (range.kind === "single" && (block === void 0 || !TOOLBAR_BLOCK_TYPES.has(block.type))) return null;
|
|
@@ -30809,12 +30999,11 @@ const TableRow = memo(function TableRow({ id, rowTransform, columnTransforms, di
|
|
|
30809
30999
|
* and the add-column chip (the table's right edge). The add-row chip and
|
|
30810
31000
|
* the size's stand stand at the frame's level (they stay pinned while the
|
|
30811
31001
|
* content scrolls) — over the entry. */
|
|
30812
|
-
function TableSeams({
|
|
31002
|
+
function TableSeams({ widths, tableWidth, tableHeight, seamXs, resizePreview, addPreview, onSeamPointerDown, onSeamPointerMove, onSeamPointerUp, onSeamPointerCancel, onSeamKeyDown, onAddChipPointerDown, onAddChipPointerMove, onAddChipPointerUp, onAddChipPointerCancel, insertTableColumn }) {
|
|
30813
31003
|
const { t } = useTranslation("table");
|
|
30814
31004
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
30815
31005
|
widths.map((_, col) => {
|
|
30816
31006
|
const seamIndex = col + 1;
|
|
30817
|
-
if (blockedSeams.has(seamIndex)) return null;
|
|
30818
31007
|
const x = col + 1 < widths.length ? seamXs[seamIndex] ?? 20 + tableWidth : 20 + tableWidth;
|
|
30819
31008
|
return /* @__PURE__ */ jsx("div", {
|
|
30820
31009
|
"data-slot": "docblocks/table-col-resize",
|
|
@@ -31436,11 +31625,12 @@ function useTableMetrics({ scrollRef, tableWidth, rows }) {
|
|
|
31436
31625
|
//#endregion
|
|
31437
31626
|
//#region src/blocks/table/use-table-regions.ts
|
|
31438
31627
|
/**
|
|
31439
|
-
* The table's merged regions over the renderer's chrome:
|
|
31440
|
-
*
|
|
31441
|
-
*
|
|
31442
|
-
*
|
|
31443
|
-
*
|
|
31628
|
+
* The table's merged regions over the renderer's chrome: no reorder handle
|
|
31629
|
+
* for a column / row the region spans (a reorder through a region would shift
|
|
31630
|
+
* its rectangle; the core rejects it, and the chrome simply offers nothing).
|
|
31631
|
+
* The region's column seams stand unblocked — a covered column resizes on its
|
|
31632
|
+
* own seam, and the region's width follows the columns' sum (the core's
|
|
31633
|
+
* width set has no region guard).
|
|
31444
31634
|
*/
|
|
31445
31635
|
/**
|
|
31446
31636
|
* The region-derived chrome stands. The chrome stamp re-reads the grid over
|
|
@@ -31453,18 +31643,13 @@ function useTableRegions({ doc, tableId }) {
|
|
|
31453
31643
|
const chromeStamp = useStore(store, (state) => state.chromeStamp);
|
|
31454
31644
|
return useMemo(() => {
|
|
31455
31645
|
const grid = resolveTableGrid(doc.raw, tableId);
|
|
31456
|
-
const blockedSeams = /* @__PURE__ */ new Set();
|
|
31457
31646
|
const lockedColumns = /* @__PURE__ */ new Set();
|
|
31458
31647
|
const lockedRows = /* @__PURE__ */ new Set();
|
|
31459
31648
|
for (const anchor of grid?.rows.flat() ?? []) {
|
|
31460
|
-
if (anchor.colspan > 1)
|
|
31461
|
-
for (let col = anchor.col + 1; col < anchor.col + anchor.colspan; col += 1) blockedSeams.add(col);
|
|
31462
|
-
for (let col = anchor.col; col < anchor.col + anchor.colspan; col += 1) lockedColumns.add(col);
|
|
31463
|
-
}
|
|
31649
|
+
if (anchor.colspan > 1) for (let col = anchor.col; col < anchor.col + anchor.colspan; col += 1) lockedColumns.add(col);
|
|
31464
31650
|
if (anchor.rowspan > 1) for (let row = anchor.row; row < anchor.row + anchor.rowspan; row += 1) lockedRows.add(row);
|
|
31465
31651
|
}
|
|
31466
31652
|
return {
|
|
31467
|
-
blockedSeams,
|
|
31468
31653
|
lockedColumns,
|
|
31469
31654
|
lockedRows
|
|
31470
31655
|
};
|
|
@@ -31674,7 +31859,7 @@ function TableBlock({ id, block }) {
|
|
|
31674
31859
|
});
|
|
31675
31860
|
const columnCenters = columnCentersOf(widths);
|
|
31676
31861
|
const seamXs = seamXsOf(widths);
|
|
31677
|
-
const {
|
|
31862
|
+
const { lockedColumns, lockedRows } = useTableRegions({
|
|
31678
31863
|
doc,
|
|
31679
31864
|
tableId: id
|
|
31680
31865
|
});
|
|
@@ -31751,7 +31936,6 @@ function TableBlock({ id, block }) {
|
|
|
31751
31936
|
onRowHandleColor,
|
|
31752
31937
|
palette
|
|
31753
31938
|
}), /* @__PURE__ */ jsx(TableSeams, {
|
|
31754
|
-
blockedSeams,
|
|
31755
31939
|
widths,
|
|
31756
31940
|
tableWidth,
|
|
31757
31941
|
tableHeight,
|
|
@@ -35313,6 +35497,23 @@ function useEditorContext() {
|
|
|
35313
35497
|
return context;
|
|
35314
35498
|
}
|
|
35315
35499
|
//#endregion
|
|
35500
|
+
//#region src/editor-provider/published-stand.ts
|
|
35501
|
+
/** The published snapshot's stand key: one key per snapshot instance. A new
|
|
35502
|
+
* snapshot remounts the nested published provider (the doc's stand must not
|
|
35503
|
+
* change over a mounted provider — the doc's stand guard), while the same
|
|
35504
|
+
* snapshot keeps its stand over the re-renders. */
|
|
35505
|
+
const SNAPSHOT_KEYS = /* @__PURE__ */ new WeakMap();
|
|
35506
|
+
let SNAPSHOT_KEY_SEQ = 0;
|
|
35507
|
+
function publishedStandKey(doc) {
|
|
35508
|
+
let key = SNAPSHOT_KEYS.get(doc);
|
|
35509
|
+
if (key === void 0) {
|
|
35510
|
+
key = SNAPSHOT_KEY_SEQ;
|
|
35511
|
+
SNAPSHOT_KEY_SEQ += 1;
|
|
35512
|
+
SNAPSHOT_KEYS.set(doc, key);
|
|
35513
|
+
}
|
|
35514
|
+
return `published-${key}`;
|
|
35515
|
+
}
|
|
35516
|
+
//#endregion
|
|
35316
35517
|
//#region src/presence/utils.ts
|
|
35317
35518
|
/** Deterministic hue (0–359) from the peer id (pure function, no peer state). */
|
|
35318
35519
|
function peerHue(peerId) {
|
|
@@ -35749,17 +35950,6 @@ function useTrailingParagraph(doc, rootBlockId, editingStand) {
|
|
|
35749
35950
|
//#region src/editor-provider/EditorProvider.tsx
|
|
35750
35951
|
/** The per-instance editor provider: the doc + store + selection lifecycle
|
|
35751
35952
|
* + the per-instance customization context. */
|
|
35752
|
-
const SNAPSHOT_KEYS = /* @__PURE__ */ new WeakMap();
|
|
35753
|
-
let SNAPSHOT_KEY_SEQ = 0;
|
|
35754
|
-
function publishedStandKey(doc) {
|
|
35755
|
-
let key = SNAPSHOT_KEYS.get(doc);
|
|
35756
|
-
if (key === void 0) {
|
|
35757
|
-
key = SNAPSHOT_KEY_SEQ;
|
|
35758
|
-
SNAPSHOT_KEY_SEQ += 1;
|
|
35759
|
-
SNAPSHOT_KEYS.set(doc, key);
|
|
35760
|
-
}
|
|
35761
|
-
return `published-${key}`;
|
|
35762
|
-
}
|
|
35763
35953
|
/**
|
|
35764
35954
|
* The stand: owns the per-instance editor lifecycle — the zustand store
|
|
35765
35955
|
* (projection of the doc), the selection view, and the subscriptions that
|
|
@@ -35771,7 +35961,7 @@ function publishedStandKey(doc) {
|
|
|
35771
35961
|
* its own. Safe under StrictMode double-mount: the cleanup detaches every
|
|
35772
35962
|
* subscription and destroys the view between the two mounts.
|
|
35773
35963
|
*/
|
|
35774
|
-
function EditorProviderStand({ doc, provider, blockRenderers, blobStore, blobLoading, scrollContainer, databaseBridge, syncEmbedResolver, pdfPreview, mentionProvider, mentionInteractions, embedSandbox, rootBlockId, commandPalettePlaceholder, accessLevel, mode, publishedDoc, presence, hiddenAttributes, renderAttribute, attributeTypePicker, docTags, docDescription, coverPresets, children }) {
|
|
35964
|
+
function EditorProviderStand({ doc, provider, blockRenderers, blobStore, blobLoading, scrollContainer, databaseBridge, databaseTableSection, syncEmbedResolver, pdfPreview, mentionProvider, mentionInteractions, embedSandbox, rootBlockId, commandPalettePlaceholder, accessLevel, mode, publishedDoc, publishedCopyable, presence, hiddenAttributes, renderAttribute, attributeTypePicker, docTags, docDescription, coverPresets, children }) {
|
|
35775
35965
|
const rootId = rootBlockId ?? doc.meta.id;
|
|
35776
35966
|
const [store] = useState(() => createEditorStore(doc, rootId));
|
|
35777
35967
|
const docRef = useRef(doc);
|
|
@@ -35809,6 +35999,8 @@ function EditorProviderStand({ doc, provider, blockRenderers, blobStore, blobLoa
|
|
|
35809
35999
|
const effectiveBlobLoading = blobLoading ?? parentContext?.blobLoading ?? "lazy";
|
|
35810
36000
|
const effectiveScrollContainer = scrollContainer === void 0 ? parentContext?.scrollContainer ?? null : scrollContainer;
|
|
35811
36001
|
const effectiveDatabaseBridge = useMemo(() => databaseBridge ?? parentContext?.databaseBridge, [databaseBridge, parentContext]);
|
|
36002
|
+
const effectiveDatabaseTableSection = databaseTableSection ?? parentContext?.databaseTableSection ?? null;
|
|
36003
|
+
const effectivePublishedCopyable = publishedCopyable ?? parentContext?.publishedCopyable ?? false;
|
|
35812
36004
|
const value = useMemo(() => {
|
|
35813
36005
|
const parent = parentContext;
|
|
35814
36006
|
return {
|
|
@@ -35820,6 +36012,7 @@ function EditorProviderStand({ doc, provider, blockRenderers, blobStore, blobLoa
|
|
|
35820
36012
|
blobLoading: effectiveBlobLoading,
|
|
35821
36013
|
scrollContainer: effectiveScrollContainer,
|
|
35822
36014
|
databaseBridge: effectiveDatabaseBridge,
|
|
36015
|
+
databaseTableSection: effectiveDatabaseTableSection,
|
|
35823
36016
|
syncEmbedResolver: syncEmbedResolver ?? parent?.syncEmbedResolver ?? null,
|
|
35824
36017
|
pdfPreview: pdfPreview ?? parent?.pdfPreview ?? null,
|
|
35825
36018
|
mentionProvider: mentionProvider ?? parent?.mentionProvider ?? null,
|
|
@@ -35837,6 +36030,7 @@ function EditorProviderStand({ doc, provider, blockRenderers, blobStore, blobLoa
|
|
|
35837
36030
|
commandPalettePlaceholder: commandPalettePlaceholder ?? parent?.commandPalettePlaceholder ?? null,
|
|
35838
36031
|
accessLevel: effectiveAccessLevel,
|
|
35839
36032
|
mode: effectiveMode,
|
|
36033
|
+
publishedCopyable: effectivePublishedCopyable,
|
|
35840
36034
|
viewMode: effectiveMode !== "edit",
|
|
35841
36035
|
presence: presence ?? null
|
|
35842
36036
|
};
|
|
@@ -35848,6 +36042,7 @@ function EditorProviderStand({ doc, provider, blockRenderers, blobStore, blobLoa
|
|
|
35848
36042
|
effectiveBlobLoading,
|
|
35849
36043
|
effectiveScrollContainer,
|
|
35850
36044
|
effectiveDatabaseBridge,
|
|
36045
|
+
effectiveDatabaseTableSection,
|
|
35851
36046
|
syncEmbedResolver,
|
|
35852
36047
|
rootId,
|
|
35853
36048
|
parentContext,
|
|
@@ -35858,6 +36053,7 @@ function EditorProviderStand({ doc, provider, blockRenderers, blobStore, blobLoa
|
|
|
35858
36053
|
embedSandbox,
|
|
35859
36054
|
effectiveAccessLevel,
|
|
35860
36055
|
effectiveMode,
|
|
36056
|
+
effectivePublishedCopyable,
|
|
35861
36057
|
presence,
|
|
35862
36058
|
hiddenAttributes,
|
|
35863
36059
|
renderAttribute,
|
|
@@ -38593,12 +38789,13 @@ function clipboardContentOf(doc, selection) {
|
|
|
38593
38789
|
* selection view (the mapping owns it); the view's mode maps the DOM
|
|
38594
38790
|
* selection at copy time — the read-only stand keeps no live view (the
|
|
38595
38791
|
* browser's native range is the only selection there). The published
|
|
38596
|
-
* stand
|
|
38792
|
+
* stand intercepts only over the consumer's copyable policy — the default
|
|
38793
|
+
* keeps the reader's selection and copy off.
|
|
38597
38794
|
*/
|
|
38598
38795
|
function createCopyHandler(deps) {
|
|
38599
|
-
const { doc, mode, viewMode, rootRef, selectionRef } = deps;
|
|
38796
|
+
const { doc, mode, viewMode, publishedCopyable, rootRef, selectionRef } = deps;
|
|
38600
38797
|
return (event) => {
|
|
38601
|
-
if (mode === "published") return;
|
|
38798
|
+
if (mode === "published" && !publishedCopyable) return;
|
|
38602
38799
|
const root = rootRef.current;
|
|
38603
38800
|
const view = selectionRef.view;
|
|
38604
38801
|
if (root === null || view === null) return;
|
|
@@ -38766,7 +38963,7 @@ function useSelectionTracking(doc, rootRef, selectionRef, viewMode) {
|
|
|
38766
38963
|
* so a render-time value would be a stale null.
|
|
38767
38964
|
*/
|
|
38768
38965
|
function useEditing() {
|
|
38769
|
-
const { doc, rootBlockId, selection: selectionRef, viewMode, mode } = useEditorContext();
|
|
38966
|
+
const { doc, rootBlockId, selection: selectionRef, viewMode, mode, publishedCopyable } = useEditorContext();
|
|
38770
38967
|
const rootRef = useRef(null);
|
|
38771
38968
|
const crossDrag = useCrossDrag(rootRef, doc, viewMode);
|
|
38772
38969
|
useSelectionTracking(doc, rootRef, selectionRef, viewMode);
|
|
@@ -38820,6 +39017,7 @@ function useEditing() {
|
|
|
38820
39017
|
doc,
|
|
38821
39018
|
mode,
|
|
38822
39019
|
viewMode,
|
|
39020
|
+
publishedCopyable,
|
|
38823
39021
|
rootRef,
|
|
38824
39022
|
selectionRef
|
|
38825
39023
|
}),
|
|
@@ -39859,7 +40057,7 @@ function useMotionDrag({ doc, rootBlockId, store, rootRef, rowKeys, nodesById })
|
|
|
39859
40057
|
* palette.
|
|
39860
40058
|
*/
|
|
39861
40059
|
function Editor({ view = "page", formatPalette = FORMAT_PALETTE }) {
|
|
39862
|
-
const { doc, store, rootBlockId, viewMode, mode, mentionInteractions } = useEditorContext();
|
|
40060
|
+
const { doc, store, rootBlockId, viewMode, mode, publishedCopyable, mentionInteractions } = useEditorContext();
|
|
39863
40061
|
const rootChildren = useStore(store, (state) => state.rootChildren);
|
|
39864
40062
|
const attributes = useStore(store, (state) => state.meta.attributes);
|
|
39865
40063
|
const coverTintEnabled = (typeof attributes?.cover === "string" ? attributes.cover : void 0) !== void 0 && attributes?.coverTint !== false;
|
|
@@ -39937,6 +40135,7 @@ function Editor({ view = "page", formatPalette = FORMAT_PALETTE }) {
|
|
|
39937
40135
|
"data-view": view,
|
|
39938
40136
|
"data-mode": mode,
|
|
39939
40137
|
"data-readonly": viewMode ? "true" : void 0,
|
|
40138
|
+
"data-copyable": mode === "published" && publishedCopyable ? "true" : void 0,
|
|
39940
40139
|
"data-mention-interactive": mentionInteractions !== null ? "true" : void 0,
|
|
39941
40140
|
tabIndex: -1,
|
|
39942
40141
|
className: cn("relative min-h-0 flex-1 selection:bg-(--docblocks-selection-background)", "font-(family-name:--docblocks-font-family) text-(length:--docblocks-font-size)", "leading-(--docblocks-line-height) text-(--docblocks-text-color)"),
|
|
@@ -778,6 +778,20 @@ declare function cellValueEqual(current: unknown, next: unknown): boolean;
|
|
|
778
778
|
* convergence is the rebaseline (the next snapshot / the envelope). */
|
|
779
779
|
declare function newMutationContext(): MutationContext;
|
|
780
780
|
//#endregion
|
|
781
|
+
//#region src/database/table-section.d.ts
|
|
782
|
+
/** The consumer's per-table section settings: the values that belong to
|
|
783
|
+
* the table itself rather than to a document block. The consumer owns the
|
|
784
|
+
* storage (its own table registry); the package reads the values as the
|
|
785
|
+
* block's fallback and writes them back over the section's own grid. */
|
|
786
|
+
interface DatabaseTableSection {
|
|
787
|
+
/** The table's persisted header-row height (px); `undefined` stands none
|
|
788
|
+
* (the block's own attr over it, else the auto height). */
|
|
789
|
+
getHeaderHeight?: (tableId: string) => number | undefined;
|
|
790
|
+
/** Commits the header-row height for the table (the section's grid drag's
|
|
791
|
+
* release): one value over every block referencing the table. */
|
|
792
|
+
setHeaderHeight?: (tableId: string, height: number) => void;
|
|
793
|
+
}
|
|
794
|
+
//#endregion
|
|
781
795
|
//#region src/database/standalone/models.d.ts
|
|
782
796
|
/**
|
|
783
797
|
* The database table's view settings — the standalone's `DatabaseTable`
|
|
@@ -834,6 +848,10 @@ interface DatabaseTableProps {
|
|
|
834
848
|
* constrained root stands the grid's inner scroll (the unconstrained's
|
|
835
849
|
* stand is the content's height, as over the document's block). */
|
|
836
850
|
className?: string;
|
|
851
|
+
/** The consumer's per-table section settings: the header-row height the
|
|
852
|
+
* table itself carries (the document blocks reference the same table id
|
|
853
|
+
* and read the same stand over their provider's `databaseTableSection`). */
|
|
854
|
+
tableSection?: DatabaseTableSection;
|
|
837
855
|
}
|
|
838
856
|
/**
|
|
839
857
|
* The standalone's database table: the live grid over the bridge's table
|
|
@@ -849,7 +867,7 @@ interface DatabaseTableProps {
|
|
|
849
867
|
* stands the grid's inner scroll; the unconstrained's stand is the
|
|
850
868
|
* content's height).
|
|
851
869
|
*/
|
|
852
|
-
declare function DatabaseTable({ bridge, tableId, readOnly, view, onViewChange, className }: DatabaseTableProps): import("react").JSX.Element;
|
|
870
|
+
declare function DatabaseTable({ bridge, tableId, readOnly, view, onViewChange, className, tableSection }: DatabaseTableProps): import("react").JSX.Element;
|
|
853
871
|
//#endregion
|
|
854
872
|
//#region src/database/standalone/use-table-list.d.ts
|
|
855
873
|
/**
|
|
@@ -927,7 +945,7 @@ interface MentionInteractions {
|
|
|
927
945
|
* mode (consumer session state, never document data). */
|
|
928
946
|
/** The consumer's user access level: the available document modes. "viewer" is locked to the published's view (the current state is never rendered); "editor" (the default) may edit and view. Session state — not document data, never on the wire. */
|
|
929
947
|
type AccessLevel = "viewer" | "editor";
|
|
930
|
-
/** The document's mode (consumer-controlled view state, like the page/canvas `view`): "edit" (the default) is the live document editable; "view" is the live document read-only (the current state, still syncing) with its text selectable and copyable; "published" is the `publishedDoc`'s snapshot read-only (static) with no selection and no copy. */
|
|
948
|
+
/** The document's mode (consumer-controlled view state, like the page/canvas `view`): "edit" (the default) is the live document editable; "view" is the live document read-only (the current state, still syncing) with its text selectable and copyable; "published" is the `publishedDoc`'s snapshot read-only (static) with no selection and no copy by default — the `publishedCopyable` provider prop lifts the block per reader (the `view` mode's payload). */
|
|
931
949
|
type EditorMode = "edit" | "view" | "published";
|
|
932
950
|
//#endregion
|
|
933
951
|
//#region src/editor-provider/models/panels.d.ts
|
|
@@ -1133,6 +1151,21 @@ interface EditorProviderBaseProps {
|
|
|
1133
1151
|
* none inherits the enclosing bridge.
|
|
1134
1152
|
*/
|
|
1135
1153
|
databaseBridge?: DatabaseBridge;
|
|
1154
|
+
/**
|
|
1155
|
+
* Optional per-table section settings: the values the consumer keeps for
|
|
1156
|
+
* the table itself instead of a document block, keyed by the bridge's
|
|
1157
|
+
* table id. `getHeaderHeight` feeds the external-form grid's header-row
|
|
1158
|
+
* height as the block's fallback — a block's own `headerHeight` attr wins
|
|
1159
|
+
* over it, an absent stand is the auto height; `setHeaderHeight` is the
|
|
1160
|
+
* section's own grid's commit (the standalone `DatabaseTable` over the
|
|
1161
|
+
* same table id). Without the prop the grid keeps the document-level
|
|
1162
|
+
* stand only (the block's attr).
|
|
1163
|
+
*
|
|
1164
|
+
* Like `databaseBridge`, the value is read per render into the provider
|
|
1165
|
+
* context: pass a stable reference. A nested provider that supplies none
|
|
1166
|
+
* inherits the enclosing stand.
|
|
1167
|
+
*/
|
|
1168
|
+
databaseTableSection?: DatabaseTableSection;
|
|
1136
1169
|
/**
|
|
1137
1170
|
* Optional PDF first-page preview renderer for file blocks and legacy PDF
|
|
1138
1171
|
* image blocks. The component receives the library-owned object URL and the
|
|
@@ -1207,6 +1240,10 @@ interface EditorContextValue {
|
|
|
1207
1240
|
* undefined when none was supplied — the external-form database blocks
|
|
1208
1241
|
* render the disconnected placeholder. */
|
|
1209
1242
|
databaseBridge: DatabaseBridge | undefined;
|
|
1243
|
+
/** The consumer's per-table section settings (the `databaseTableSection`
|
|
1244
|
+
* prop): the table-level values the grid reads as the block's fallback;
|
|
1245
|
+
* null when none was supplied. */
|
|
1246
|
+
databaseTableSection: DatabaseTableSection | null;
|
|
1210
1247
|
/** The sync-embed master-doc resolver; null when none was supplied. */
|
|
1211
1248
|
syncEmbedResolver: SyncEmbedResolver | null;
|
|
1212
1249
|
/** The consumer's PDF first-page preview renderer; null when none was supplied (the native iframe stands). */
|
|
@@ -1241,6 +1278,8 @@ interface EditorContextValue {
|
|
|
1241
1278
|
accessLevel: AccessLevel;
|
|
1242
1279
|
/** The effective document mode (resolved: a viewer stands "published" over any stand; a nested provider without its own `mode` inherits the enclosing one). */
|
|
1243
1280
|
mode: EditorMode;
|
|
1281
|
+
/** The published stand's selection policy (`publishedCopyable`): true makes the published snapshot's page text selectable and copyable — the `view` mode's parity; false (the default) keeps the reader's selection off. The canvas world keeps the no-select stand either way. */
|
|
1282
|
+
publishedCopyable: boolean;
|
|
1244
1283
|
/** True over the non-edit modes ("view" / "published"): every editing surface gates off (the read-only stand). */
|
|
1245
1284
|
viewMode: boolean;
|
|
1246
1285
|
/** The presence identity + cipher (the provider's `presence` prop); null when none was supplied (the legacy's anonymous stand). */
|
|
@@ -1275,6 +1314,18 @@ interface EditorProviderAccessProps {
|
|
|
1275
1314
|
* snapshot is a consumer remount over a `key` change.
|
|
1276
1315
|
*/
|
|
1277
1316
|
publishedDoc?: Doc | null;
|
|
1317
|
+
/**
|
|
1318
|
+
* The published stand's selection policy (default `false`): `true` makes
|
|
1319
|
+
* the published snapshot's page text selectable and copyable — the
|
|
1320
|
+
* `view` mode's parity (the native range over the non-editable inners,
|
|
1321
|
+
* the editor's copy payload: marks, `@label` mentions, cross-block
|
|
1322
|
+
* ranges, and the table's grid serialization), so the consumer decides
|
|
1323
|
+
* per reader whether the published state may be quoted. The canvas
|
|
1324
|
+
* world keeps the no-select stand in every mode. Session state supplied
|
|
1325
|
+
* by the consumer — never document data. A nested provider without its
|
|
1326
|
+
* own stand inherits the enclosing one.
|
|
1327
|
+
*/
|
|
1328
|
+
publishedCopyable?: boolean;
|
|
1278
1329
|
/**
|
|
1279
1330
|
* Optional presence identity + the selection-sharing cipher (consumer
|
|
1280
1331
|
* session state, never document data): the local user's stable `userId`
|
|
@@ -1464,4 +1515,4 @@ declare const DEFAULT_EMBED_SANDBOX = "allow-scripts allow-same-origin allow-for
|
|
|
1464
1515
|
/** Read the per-instance editor context; throws outside an EditorProvider. */
|
|
1465
1516
|
declare function useEditorContext(): EditorContextValue;
|
|
1466
1517
|
//#endregion
|
|
1467
|
-
export {
|
|
1518
|
+
export { SubscriptionStatus as $, useDatabaseTable as A, AttributeTypePickerProps as At, BridgeColumnAnnotation as B, DatabaseTable as C, isBridgeErrorCode as Ct, DatabaseTableSection as D, BlobStore as Dt, UseTableList as E, BlobRef as Et, filterIsComplete as F, MutationContext as G, BridgeValueInput as H, FilterBuilder as I, ProtocolCapability as J, MutationReceipt as K, BatchOp as L, DatabaseTableRow as M, RenderAttributeProps as Mt, UseDatabaseTable as N, cellValueEqual as O, createMemoryBlobStore as Ot, emptyFilter as P, SubscriptionObserver as Q, DatabaseBridge as R, useTableList as S, isBridgeError as St, DatabaseTableView as T, BlobMeta as Tt, CellValueParse as U, BridgeTableDescription as V, DomainEvent as W, ProtocolLimits as X, ProtocolDescriptor as Y, SubscriptionHandle as Z, AccessLevel as _, TableRef as _t, EditorContextValue as a, FilterInput as at, MentionInteractions as b, BridgeError as bt, SelectionRef as c, PageQuery as ct, PdfPreview as d, QuerySemantics as dt, TableEnvelopeBase as et, PdfPreviewProps as f, Revision as ft, DocTags as g, TableDescription as gt, DocTag as h, SortInput as ht, EditorProviderProps as i, FilterConditionInput as it, DatabaseTablePhase as j, RenderAttribute as jt, newMutationContext as k, AttributeTypePicker as kt, BlobLoading as l, PageSnapshot as lt, DocDescription as m, RowWire as mt, DEFAULT_EMBED_SANDBOX as n, CellMap as nt, EmbedSandboxPolicy as o, Id as ot, CoverPresetSets as p, RowPage as pt, OperationStatus as q, EditorProvider as r, Column as rt, SyncEmbedResolver as s, IsoInstant as st, useEditorContext as t, TableEvent as tt, PresenceConfig as u, QueryOperator as ut, EditorMode as v, TableSnapshot as vt, DatabaseTableProps as w, toBridgeError as wt, MentionProvider as x, BridgeErrorCode as xt, MentionEntry as y, BRIDGE_ERROR_CODES as yt, BridgeColumn as z };
|
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
|
|
2
|
+
import { $ as SubscriptionStatus, A as useDatabaseTable, At as AttributeTypePickerProps, B as BridgeColumnAnnotation, C as DatabaseTable, Ct as isBridgeErrorCode, D as DatabaseTableSection, Dt as BlobStore, E as UseTableList, Et as BlobRef, F as filterIsComplete, G as MutationContext, H as BridgeValueInput, I as FilterBuilder, J as ProtocolCapability, K as MutationReceipt, L as BatchOp, M as DatabaseTableRow, Mt as RenderAttributeProps, N as UseDatabaseTable, O as cellValueEqual, Ot as createMemoryBlobStore, P as emptyFilter, Q as SubscriptionObserver, R as DatabaseBridge, S as useTableList, St as isBridgeError, T as DatabaseTableView, Tt as BlobMeta, U as CellValueParse, V as BridgeTableDescription, W as DomainEvent, X as ProtocolLimits, Y as ProtocolDescriptor, Z as SubscriptionHandle, _ as AccessLevel, _t as TableRef, a as EditorContextValue, at as FilterInput, b as MentionInteractions, bt as BridgeError, c as SelectionRef, ct as PageQuery, d as PdfPreview, dt as QuerySemantics, et as TableEnvelopeBase, f as PdfPreviewProps, ft as Revision, g as DocTags, gt as TableDescription, h as DocTag, ht as SortInput, i as EditorProviderProps, it as FilterConditionInput, j as DatabaseTablePhase, jt as RenderAttribute, k as newMutationContext, kt as AttributeTypePicker, l as BlobLoading, lt as PageSnapshot, m as DocDescription, mt as RowWire, n as DEFAULT_EMBED_SANDBOX, nt as CellMap, o as EmbedSandboxPolicy, ot as Id, p as CoverPresetSets, pt as RowPage, q as OperationStatus, r as EditorProvider, rt as Column, s as SyncEmbedResolver, st as IsoInstant, t as useEditorContext, tt as TableEvent, u as PresenceConfig, ut as QueryOperator, v as EditorMode, vt as TableSnapshot, w as DatabaseTableProps, wt as toBridgeError, x as MentionProvider, xt as BridgeErrorCode, y as MentionEntry, yt as BRIDGE_ERROR_CODES, z as BridgeColumn } from "./index-DAc-REs_.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";
|
|
@@ -574,4 +574,4 @@ declare function TooltipContent({ className, sideOffset, children, ...props }: R
|
|
|
574
574
|
//#region src/shared/ui/cn.d.ts
|
|
575
575
|
declare function cn(...inputs: ClassValue[]): string;
|
|
576
576
|
//#endregion
|
|
577
|
-
export { type AccessLevel, Alert, AlertDescription, AlertTitle, type AttributeType, type AttributeTypePicker, type AttributeTypePickerProps, BASELINE_CAPABILITIES, BRIDGE_ERROR_CODES, Badge, BareSelect, type BatchOp, type BlobLoading, type BlobMeta, BlobNotFoundError, type BlobRef, type BlobStore, type BlockRenderer, type BlockRendererMap, type BlockRendererProps, type BridgeColumn, type BridgeColumnAnnotation, BridgeError, type BridgeErrorCode, type BridgeTableDescription, type BridgeValueInput, Button, CanvasPasteError, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CellMap, type CellValueParse, Checkbox, type Column, type CoverPresetSets, DEFAULT_EMBED_SANDBOX, type DatabaseBridge, DatabaseTable, type DatabaseTablePhase, type DatabaseTableProps, type DatabaseTableRow, type DatabaseTableView, DocBlocksUiError, type DocDescription, DocHeader, type DocHeaderAvatarContentContext, type DocTag, type DocTags, DocblocksI18nProvider, type DocblocksI18nProviderProps, type DomainEvent, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Editor, type EditorContextValue, EditorErrorBoundary, type EditorErrorBoundaryProps, type EditorMode, EditorProvider, EditorProviderError, type EditorProviderProps, type EditorView, type EmbedSandboxPolicy, FORMAT_PALETTE, FilterBuilder, type FilterConditionInput, type FilterInput, type FormatMark, HookMisuseError, type Id, ImportDocumentError, Input, type IsoInstant, Label, MONO_FONT_STACK, type MentionEntry, type MentionInteractions, type MentionMark, type MentionProvider, type MutationContext, type MutationReceipt, type OperationStatus, PROTOCOL_VERSION, type PageQuery, type PageSnapshot, PdfFetchError, type PdfPreview, type PdfPreviewProps, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, type PresenceConfig, type PresenceCrypto, type PresenceIdentity, type PresencePeer, type PresenceSharing, type PresenceSharingMode, type ProtocolCapability, type ProtocolDescriptor, type ProtocolLimits, type QueryOperator, type QuerySemantics, type RenderAttribute, type RenderAttributeProps, type Revision, type RowPage, type RowWire, SHAPE_FONT_OPTIONS, SHAPE_FONT_STACKS, ScrollArea, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, type SelectionRef, Separator, Skeleton, type SortInput, type SubscriptionHandle, type SubscriptionObserver, type SubscriptionStatus, type SyncEmbedRef, type SyncEmbedResolver, TEXT_TYPES, type TableDescription, type TableEnvelopeBase, type TableEvent, type TableRef, type TableSnapshot, Tabs, TabsContent, TabsList, TabsTrigger, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type TypedAttributeValue, UI_FONT_ID, UI_FONT_STACK, UnhandledValueError, UnknownSlashCommandError, type UseDatabaseTable, type UseTableList, badgeVariants, buttonVariants, cellValueEqual, cn, columnAnnotation, conditionMatches, createMemoryBlobStore, emptyFilter, filterIsComplete, importDocument, isBridgeError, isBridgeErrorCode, isDatabaseBridge, markToggleAction, newMutationContext, parseCellValue, renderRuns, toBridgeError, useBlock, useCoverAverageColor, useDatabaseTable, useDoc, useEditorContext, useMeta, usePresence, usePresenceSharing, useSelection, useSelectionView, useTableList, useText, validateProtocolDescriptor };
|
|
577
|
+
export { type AccessLevel, Alert, AlertDescription, AlertTitle, type AttributeType, type AttributeTypePicker, type AttributeTypePickerProps, BASELINE_CAPABILITIES, BRIDGE_ERROR_CODES, Badge, BareSelect, type BatchOp, type BlobLoading, type BlobMeta, BlobNotFoundError, type BlobRef, type BlobStore, type BlockRenderer, type BlockRendererMap, type BlockRendererProps, type BridgeColumn, type BridgeColumnAnnotation, BridgeError, type BridgeErrorCode, type BridgeTableDescription, type BridgeValueInput, Button, CanvasPasteError, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CellMap, type CellValueParse, Checkbox, type Column, type CoverPresetSets, DEFAULT_EMBED_SANDBOX, type DatabaseBridge, DatabaseTable, type DatabaseTablePhase, type DatabaseTableProps, type DatabaseTableRow, type DatabaseTableSection, type DatabaseTableView, DocBlocksUiError, type DocDescription, DocHeader, type DocHeaderAvatarContentContext, type DocTag, type DocTags, DocblocksI18nProvider, type DocblocksI18nProviderProps, type DomainEvent, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Editor, type EditorContextValue, EditorErrorBoundary, type EditorErrorBoundaryProps, type EditorMode, EditorProvider, EditorProviderError, type EditorProviderProps, type EditorView, type EmbedSandboxPolicy, FORMAT_PALETTE, FilterBuilder, type FilterConditionInput, type FilterInput, type FormatMark, HookMisuseError, type Id, ImportDocumentError, Input, type IsoInstant, Label, MONO_FONT_STACK, type MentionEntry, type MentionInteractions, type MentionMark, type MentionProvider, type MutationContext, type MutationReceipt, type OperationStatus, PROTOCOL_VERSION, type PageQuery, type PageSnapshot, PdfFetchError, type PdfPreview, type PdfPreviewProps, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, type PresenceConfig, type PresenceCrypto, type PresenceIdentity, type PresencePeer, type PresenceSharing, type PresenceSharingMode, type ProtocolCapability, type ProtocolDescriptor, type ProtocolLimits, type QueryOperator, type QuerySemantics, type RenderAttribute, type RenderAttributeProps, type Revision, type RowPage, type RowWire, SHAPE_FONT_OPTIONS, SHAPE_FONT_STACKS, ScrollArea, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, type SelectionRef, Separator, Skeleton, type SortInput, type SubscriptionHandle, type SubscriptionObserver, type SubscriptionStatus, type SyncEmbedRef, type SyncEmbedResolver, TEXT_TYPES, type TableDescription, type TableEnvelopeBase, type TableEvent, type TableRef, type TableSnapshot, Tabs, TabsContent, TabsList, TabsTrigger, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type TypedAttributeValue, UI_FONT_ID, UI_FONT_STACK, UnhandledValueError, UnknownSlashCommandError, type UseDatabaseTable, type UseTableList, badgeVariants, buttonVariants, cellValueEqual, cn, columnAnnotation, conditionMatches, createMemoryBlobStore, emptyFilter, filterIsComplete, importDocument, isBridgeError, isBridgeErrorCode, isDatabaseBridge, markToggleAction, newMutationContext, parseCellValue, renderRuns, toBridgeError, useBlock, useCoverAverageColor, useDatabaseTable, useDoc, useEditorContext, useMeta, usePresence, usePresenceSharing, useSelection, useSelectionView, useTableList, useText, validateProtocolDescriptor };
|
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-D91f-KD8.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";
|
|
@@ -397,10 +397,21 @@ const EMPTY_VIEW = {};
|
|
|
397
397
|
* stands the grid's inner scroll; the unconstrained's stand is the
|
|
398
398
|
* content's height).
|
|
399
399
|
*/
|
|
400
|
-
function DatabaseTable({ bridge, tableId, readOnly = false, view, onViewChange, className }) {
|
|
400
|
+
function DatabaseTable({ bridge, tableId, readOnly = false, view, onViewChange, className, tableSection }) {
|
|
401
401
|
const [viewState, setViewState] = useState(view ?? EMPTY_VIEW);
|
|
402
402
|
const viewRef = useRef(viewState);
|
|
403
403
|
viewRef.current = viewState;
|
|
404
|
+
const [headerEcho, setHeaderEcho] = useState(null);
|
|
405
|
+
const sectionHeight = tableSection?.getHeaderHeight?.(tableId);
|
|
406
|
+
const sectionHeaderHeight = headerEcho !== null && headerEcho.tableId === tableId && headerEcho.base === sectionHeight ? headerEcho.height : sectionHeight;
|
|
407
|
+
const commitHeaderHeight = (height) => {
|
|
408
|
+
setHeaderEcho({
|
|
409
|
+
tableId,
|
|
410
|
+
base: sectionHeight,
|
|
411
|
+
height
|
|
412
|
+
});
|
|
413
|
+
tableSection?.setHeaderHeight?.(tableId, height);
|
|
414
|
+
};
|
|
404
415
|
const handleViewChange = useCallback((patch) => {
|
|
405
416
|
const typed = patch;
|
|
406
417
|
setViewState((current) => ({
|
|
@@ -420,6 +431,8 @@ function DatabaseTable({ bridge, tableId, readOnly = false, view, onViewChange,
|
|
|
420
431
|
columnOrder: viewState.columnOrder,
|
|
421
432
|
hiddenColumns: viewState.hiddenColumns,
|
|
422
433
|
columnWidths: viewState.columnWidths,
|
|
434
|
+
sectionHeaderHeight,
|
|
435
|
+
onHeaderHeightChange: tableSection === void 0 ? void 0 : commitHeaderHeight,
|
|
423
436
|
onViewChange: handleViewChange,
|
|
424
437
|
readColumnOrder: () => viewRef.current.columnOrder,
|
|
425
438
|
readOnly
|
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-D91f-KD8.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-DAc-REs_.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/dist/styles.css
CHANGED
|
@@ -407,6 +407,9 @@
|
|
|
407
407
|
.z-60 {
|
|
408
408
|
z-index: 60;
|
|
409
409
|
}
|
|
410
|
+
.col-span-full {
|
|
411
|
+
grid-column: 1 / -1;
|
|
412
|
+
}
|
|
410
413
|
.col-start-2 {
|
|
411
414
|
grid-column-start: 2;
|
|
412
415
|
}
|
|
@@ -664,6 +667,9 @@
|
|
|
664
667
|
.h-0\.5 {
|
|
665
668
|
height: calc(var(--spacing) * 0.5);
|
|
666
669
|
}
|
|
670
|
+
.h-1\.5 {
|
|
671
|
+
height: calc(var(--spacing) * 1.5);
|
|
672
|
+
}
|
|
667
673
|
.h-2 {
|
|
668
674
|
height: calc(var(--spacing) * 2);
|
|
669
675
|
}
|
|
@@ -940,6 +946,10 @@
|
|
|
940
946
|
--tw-translate-y: calc(calc(1 / 2 * 100%) * -1);
|
|
941
947
|
translate: var(--tw-translate-x) var(--tw-translate-y);
|
|
942
948
|
}
|
|
949
|
+
.translate-y-1\/2 {
|
|
950
|
+
--tw-translate-y: calc(1 / 2 * 100%);
|
|
951
|
+
translate: var(--tw-translate-x) var(--tw-translate-y);
|
|
952
|
+
}
|
|
943
953
|
.translate-y-3 {
|
|
944
954
|
--tw-translate-y: calc(var(--spacing) * 3);
|
|
945
955
|
translate: var(--tw-translate-x) var(--tw-translate-y);
|
|
@@ -1134,6 +1144,9 @@
|
|
|
1134
1144
|
.gap-y-0\.5 {
|
|
1135
1145
|
row-gap: calc(var(--spacing) * 0.5);
|
|
1136
1146
|
}
|
|
1147
|
+
.self-end {
|
|
1148
|
+
align-self: flex-end;
|
|
1149
|
+
}
|
|
1137
1150
|
.self-start {
|
|
1138
1151
|
align-self: flex-start;
|
|
1139
1152
|
}
|
|
@@ -3958,26 +3971,29 @@
|
|
|
3958
3971
|
* read-only — the inners stand contenteditable="false" (the caret's
|
|
3959
3972
|
* editing's affordance is impossible).
|
|
3960
3973
|
*
|
|
3961
|
-
* The PUBLISHED stand
|
|
3962
|
-
* stands no stand (the published state is readable over the rendered
|
|
3963
|
-
* only — no range, no copy). The
|
|
3964
|
-
* the
|
|
3965
|
-
*
|
|
3966
|
-
*
|
|
3967
|
-
*
|
|
3968
|
-
*
|
|
3974
|
+
* The PUBLISHED stand blocks the text selection by default: the reader's
|
|
3975
|
+
* copy stands no stand (the published state is readable over the rendered
|
|
3976
|
+
* page only — no range, no copy). The consumer lifts the block per reader
|
|
3977
|
+
* over the `publishedCopyable` prop: the copyable stand marks the root
|
|
3978
|
+
* `data-copyable="true"` and stands the `view` mode's policy (the native
|
|
3979
|
+
* selection over the page's text + the editor's copy payload — see
|
|
3980
|
+
* use-editing). The VIEW stand always keeps the native selection (the live
|
|
3981
|
+
* document is read-only but copyable: the text is the reader's to quote).
|
|
3982
|
+
* The `data-readonly` over the standalone's read-only grid (no
|
|
3983
|
+
* `data-mode` — the consumer's own surfaces) keeps the no-select stand.
|
|
3969
3984
|
*/
|
|
3970
|
-
[data-slot="docblocks/editor"][data-readonly="true"]:not([data-mode="view"]) {
|
|
3985
|
+
[data-slot="docblocks/editor"][data-readonly="true"]:not([data-mode="view"]):not([data-copyable="true"]) {
|
|
3971
3986
|
user-select: none;
|
|
3972
3987
|
}
|
|
3973
3988
|
|
|
3974
3989
|
/*
|
|
3975
|
-
* The
|
|
3976
|
-
*
|
|
3977
|
-
*
|
|
3978
|
-
*
|
|
3990
|
+
* The canvas world keeps the read-only's no-select stand over the
|
|
3991
|
+
* selectable stands (the view's mode, the copyable published stand): the
|
|
3992
|
+
* page's text stands selectable, the canvas's world does not — the native
|
|
3993
|
+
* range would fight the pan's drag (the observing gesture) and the world's
|
|
3994
|
+
* text is not an editing surface.
|
|
3979
3995
|
*/
|
|
3980
|
-
[data-slot="docblocks/editor"][data-mode="view"] [data-slot="docblocks/canvas-world"] {
|
|
3996
|
+
[data-slot="docblocks/editor"]:is([data-mode="view"], [data-copyable="true"]) [data-slot="docblocks/canvas-world"] {
|
|
3981
3997
|
user-select: none;
|
|
3982
3998
|
}
|
|
3983
3999
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docblocks-react-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.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.10.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",
|