docblocks-react-ui 0.20.0 → 0.22.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.
@@ -1,4 +1,4 @@
1
- import { a as PresenceCrypto, i as EditorStore, n as BlockRendererMap } from "./index-2gZyAsdf.mjs";
1
+ import { a as PresenceCrypto, i as EditorStore, n as BlockRendererMap } from "./index-DeOMnr7f.mjs";
2
2
  import { ComponentType, ReactNode } from "react";
3
3
  import { AttributeType, BlockId, DatabaseFilterPayload, Doc, DocAttributeValue, MentionKind, MentionMark, SelectionView, SyncEmbedRef, SyncProvider } from "docblocks-core";
4
4
  //#region src/editor-provider/models/attributes.d.ts
@@ -1101,6 +1101,20 @@ interface EditorProviderBaseProps {
1101
1101
  * A nested provider that supplies none inherits the enclosing policy.
1102
1102
  */
1103
1103
  blobLoading?: BlobLoading;
1104
+ /**
1105
+ * The scroll container that scrolls the document, when the consumer
1106
+ * renders the editor inside its own `overflow` box instead of the page
1107
+ * scroll. The lazy blob resolution's preload band is measured against
1108
+ * this element (an element clipped by an inner scroller never intersects
1109
+ * a window-rooted observer, so the band would shrink to the visible
1110
+ * area); the first screen's eager stand is measured against its box too.
1111
+ *
1112
+ * `null` (the default) stands the window — the page scroll. The value is
1113
+ * read per render into the provider context: pass a stable reference. A
1114
+ * nested provider that passes nothing inherits the enclosing container;
1115
+ * an explicit `null` frames its own subtree on the window.
1116
+ */
1117
+ scrollContainer?: Element | null;
1104
1118
  /**
1105
1119
  * Optional database bridge: the consumer's implementation of the table
1106
1120
  * operations behind the external-form database blocks (the document
@@ -1181,6 +1195,9 @@ interface EditorContextValue {
1181
1195
  /** The effective blob loading policy (the own prop, else the enclosing
1182
1196
  * one, else "lazy"). */
1183
1197
  blobLoading: BlobLoading;
1198
+ /** The consumer's scroll container (the `scrollContainer` provider prop);
1199
+ * `null` stands the window — the page scroll. */
1200
+ scrollContainer: Element | null;
1184
1201
  /** The effective database bridge (the consumer's implementation);
1185
1202
  * undefined when none was supplied — the external-form database blocks
1186
1203
  * render the disconnected placeholder. */
@@ -102,6 +102,32 @@ interface FileUploadStand {
102
102
  * slice is not involved in, so a component selecting one block re-renders
103
103
  * only when that block actually changed.
104
104
  */
105
+ /** A rectangular cell range over one table (the grid coordinates, inclusive). */
106
+ interface TableCellRange {
107
+ tableId: BlockId;
108
+ /** The rectangle's top grid row (inclusive). */
109
+ top: number;
110
+ /** The rectangle's left grid column (inclusive). */
111
+ left: number;
112
+ /** The rectangle's bottom grid row (inclusive). */
113
+ bottom: number;
114
+ /** The rectangle's right grid column (inclusive). */
115
+ right: number;
116
+ /** The anchor cells standing in the rectangle (a covered cell stands no cell). */
117
+ cellIds: readonly BlockId[];
118
+ /**
119
+ * The anchors' own grid rectangles (a merged anchor stands its region) —
120
+ * the per-cell frame edges read from it, so a cell needs no grid math.
121
+ */
122
+ cells: Readonly<Record<BlockId, TableCellRangeRect>>;
123
+ }
124
+ /** One anchor's grid rectangle inside the range (the frame edges' source). */
125
+ interface TableCellRangeRect {
126
+ row: number;
127
+ col: number;
128
+ colspan: number;
129
+ rowspan: number;
130
+ }
105
131
  interface EditorState {
106
132
  /** Block snapshots keyed by id; a block keeps its reference while its JSON is unchanged. */
107
133
  blocks: Record<BlockId, Block>;
@@ -141,6 +167,13 @@ interface EditorState {
141
167
  * A separate slice so a grant change never re-renders blocks.
142
168
  */
143
169
  sharing: PresenceSharingMode;
170
+ /**
171
+ * The table cell range: the rectangular selection of cells over one table
172
+ * (the merge / split gesture's stand). View state — never document data,
173
+ * no wire traffic; a separate slice so a range move re-renders only its
174
+ * cells.
175
+ */
176
+ tableRange: TableCellRange | null;
144
177
  /**
145
178
  * The canvas clipboard: the deep copy of
146
179
  * the copied canvas items — the view state per editor (not doc data, no
@@ -189,6 +222,8 @@ interface EditorActions {
189
222
  setSelection: (selection: Selection) => void;
190
223
  /** Sets the collapsed state of one list item (view state, no doc command). */
191
224
  setCollapsed: (id: BlockId, collapsed: boolean) => void;
225
+ /** Replaces the table cell range (the gesture's move / the clear). */
226
+ setTableCellRange: (range: TableCellRange | null) => void;
192
227
  /** Replaces the canvas clipboard slice (the copy / the clear). */
193
228
  setCanvasClipboard: (clipboard: CanvasClipboard | null) => void;
194
229
  /** Replaces the pending file upload stand (the set / the clear). */
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
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-2gZyAsdf.mjs";
2
- import { $ as TableEnvelopeBase, A as DatabaseTablePhase, At as RenderAttribute, B as BridgeTableDescription, C as DatabaseTable, Ct as toBridgeError, D as cellValueEqual, Dt as createMemoryBlobStore, E as UseTableList, Et as BlobStore, F as FilterBuilder, G as MutationReceipt, H as CellValueParse, I as BatchOp, J as ProtocolDescriptor, K as OperationStatus, L as DatabaseBridge, M as UseDatabaseTable, N as emptyFilter, O as newMutationContext, Ot as AttributeTypePicker, P as filterIsComplete, Q as SubscriptionStatus, R as BridgeColumn, S as useTableList, St as isBridgeErrorCode, T as DatabaseTableView, Tt as BlobRef, U as DomainEvent, V as BridgeValueInput, W as MutationContext, X as SubscriptionHandle, Y as ProtocolLimits, Z as SubscriptionObserver, _ as AccessLevel, _t as TableSnapshot, a as EditorContextValue, at as Id, b as MentionInteractions, bt as BridgeErrorCode, c as SelectionRef, ct as PageSnapshot, d as PdfPreview, dt as Revision, et as TableEvent, f as PdfPreviewProps, ft as RowPage, g as DocTags, gt as TableRef, h as DocTag, ht as TableDescription, i as EditorProviderProps, it as FilterInput, j as DatabaseTableRow, jt as RenderAttributeProps, k as useDatabaseTable, kt as AttributeTypePickerProps, l as BlobLoading, lt as QueryOperator, m as DocDescription, mt as SortInput, n as DEFAULT_EMBED_SANDBOX, nt as Column, o as EmbedSandboxPolicy, ot as IsoInstant, p as CoverPresetSets, pt as RowWire, q as ProtocolCapability, r as EditorProvider, rt as FilterConditionInput, s as SyncEmbedResolver, st as PageQuery, t as useEditorContext, tt as CellMap, u as PresenceConfig, ut as QuerySemantics, v as EditorMode, vt as BRIDGE_ERROR_CODES, w as DatabaseTableProps, wt as BlobMeta, x as MentionProvider, xt as isBridgeError, y as MentionEntry, yt as BridgeError, z as BridgeColumnAnnotation } from "./index-BoKKzCxv.mjs";
1
+ import { a as PresenceCrypto, c as PresenceSharing, l as PresenceSharingMode, n as BlockRendererMap, o as PresenceIdentity, r as BlockRendererProps, s as PresencePeer, t as BlockRenderer } from "./index-DeOMnr7f.mjs";
2
+ import { $ as TableEnvelopeBase, A as DatabaseTablePhase, At as RenderAttribute, B as BridgeTableDescription, C as DatabaseTable, Ct as toBridgeError, D as cellValueEqual, Dt as createMemoryBlobStore, E as UseTableList, Et as BlobStore, F as FilterBuilder, G as MutationReceipt, H as CellValueParse, I as BatchOp, J as ProtocolDescriptor, K as OperationStatus, L as DatabaseBridge, M as UseDatabaseTable, N as emptyFilter, O as newMutationContext, Ot as AttributeTypePicker, P as filterIsComplete, Q as SubscriptionStatus, R as BridgeColumn, S as useTableList, St as isBridgeErrorCode, T as DatabaseTableView, Tt as BlobRef, U as DomainEvent, V as BridgeValueInput, W as MutationContext, X as SubscriptionHandle, Y as ProtocolLimits, Z as SubscriptionObserver, _ as AccessLevel, _t as TableSnapshot, a as EditorContextValue, at as Id, b as MentionInteractions, bt as BridgeErrorCode, c as SelectionRef, ct as PageSnapshot, d as PdfPreview, dt as Revision, et as TableEvent, f as PdfPreviewProps, ft as RowPage, g as DocTags, gt as TableRef, h as DocTag, ht as TableDescription, i as EditorProviderProps, it as FilterInput, j as DatabaseTableRow, jt as RenderAttributeProps, k as useDatabaseTable, kt as AttributeTypePickerProps, l as BlobLoading, lt as QueryOperator, m as DocDescription, mt as SortInput, n as DEFAULT_EMBED_SANDBOX, nt as Column, o as EmbedSandboxPolicy, ot as IsoInstant, p as CoverPresetSets, pt as RowWire, q as ProtocolCapability, r as EditorProvider, rt as FilterConditionInput, s as SyncEmbedResolver, st as PageQuery, t as useEditorContext, tt as CellMap, u as PresenceConfig, ut as QuerySemantics, v as EditorMode, vt as BRIDGE_ERROR_CODES, w as DatabaseTableProps, wt as BlobMeta, x as MentionProvider, xt as isBridgeError, y as MentionEntry, yt as BridgeError, z as BridgeColumnAnnotation } from "./index-BV-kKwCB.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";
@@ -427,7 +427,7 @@ declare function AlertDescription({ className, ...props }: React$1.ComponentProp
427
427
  //#endregion
428
428
  //#region src/shared/ui/Badge.d.ts
429
429
  declare const badgeVariants: (props?: ({
430
- variant?: "default" | "destructive" | "custom" | "secondary" | "outline" | null | undefined;
430
+ variant?: "default" | "custom" | "secondary" | "destructive" | "outline" | null | undefined;
431
431
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
432
432
  declare function Badge({ className, variant, asChild, ...props }: React$1.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
433
433
  asChild?: boolean;
@@ -438,7 +438,7 @@ declare function BareSelect({ className, children, ...props }: React$1.Component
438
438
  //#endregion
439
439
  //#region src/shared/ui/Button.d.ts
440
440
  declare const buttonVariants: (props?: ({
441
- variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
441
+ variant?: "link" | "default" | "secondary" | "destructive" | "outline" | "ghost" | null | undefined;
442
442
  size?: "default" | "icon" | "sm" | "lg" | "xl" | null | undefined;
443
443
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
444
444
  declare function Button({ className, variant, size, asChild, type, ...props }: React$1.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
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-Oia-HUin.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-WNvtSeS1.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";
@@ -1,4 +1,4 @@
1
- import { r as BlockRendererProps } from "../index-2gZyAsdf.mjs";
1
+ import { r as BlockRendererProps } from "../index-DeOMnr7f.mjs";
2
2
  //#region src/mermaid/MermaidCodeRenderer.d.ts
3
3
  /**
4
4
  * A BlockRenderer for the `code` type. The registry dispatches by type:
@@ -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-Oia-HUin.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-WNvtSeS1.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";
@@ -1,4 +1,4 @@
1
- import { f as PdfPreviewProps } from "../index-BoKKzCxv.mjs";
1
+ import { f as PdfPreviewProps } from "../index-BV-kKwCB.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
@@ -287,6 +287,9 @@
287
287
  .top-0\.5 {
288
288
  top: calc(var(--spacing) * 0.5);
289
289
  }
290
+ .top-1 {
291
+ top: var(--spacing);
292
+ }
290
293
  .top-1\.5 {
291
294
  top: calc(var(--spacing) * 1.5);
292
295
  }
@@ -326,6 +329,9 @@
326
329
  .right-0 {
327
330
  right: 0px;
328
331
  }
332
+ .right-1 {
333
+ right: var(--spacing);
334
+ }
329
335
  .right-1\.5 {
330
336
  right: calc(var(--spacing) * 1.5);
331
337
  }
@@ -2122,6 +2128,9 @@
2122
2128
  .group-hover\:opacity-100:is(:where(.group):hover *) {
2123
2129
  opacity: 100%;
2124
2130
  }
2131
+ .group-hover\/cell\:opacity-100:is(:where(.group\/cell):hover *) {
2132
+ opacity: 100%;
2133
+ }
2125
2134
  }
2126
2135
  .group-data-horizontal\/tabs\:h-8:is(:where(.group\/tabs)[data-horizontal] *) {
2127
2136
  height: calc(var(--spacing) * 8);
@@ -3779,6 +3788,16 @@
3779
3788
  colors do not differ). */
3780
3789
  --docblocks-table-drag-background: var(--card, #ffffff);
3781
3790
  --docblocks-table-drag-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
3791
+ /* The dragged cell range (the merge / split gesture's selection): the
3792
+ canvas selection's cyan as the frame over a light tint of the same hue.
3793
+ Declared once (the canvas selection's color follows the theme flip). */
3794
+ --docblocks-table-range-background: color-mix(
3795
+ in srgb,
3796
+ var(--docblocks-canvas-selection-border-color) 22%,
3797
+ transparent
3798
+ );
3799
+ --docblocks-table-range-border-color: var(--docblocks-canvas-selection-border-color);
3800
+ --docblocks-table-range-border-width: 2px;
3782
3801
  /* The database grid's standard row height (the fixed row track: every
3783
3802
  column type stands the one height — the cell's trigger / the input fit
3784
3803
  the content box, the row never grows over its content). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docblocks-react-ui",
3
- "version": "0.20.0",
3
+ "version": "0.22.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.8.2",
39
+ "docblocks-core": "^0.9.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",