docblocks-react-ui 0.21.0 → 0.23.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
@@ -61,14 +61,19 @@ interface BlobStore {
61
61
  /** Optional lightweight display resolution: file id → the metadata WITHOUT
62
62
  * the bytes (the cheap head stand, no body transfer). The built-in
63
63
  * file / image blocks resolve the bytes over `get` only when they render
64
- * the payload (the pdf preview, the `<img>`); any other MIME stands the
65
- * meta card with the `downloadUrl`'s href. Without the member the blocks
66
- * keep the legacy stand (the bytes over `get`). Rejects an unknown id
67
- * (the missing's stand). */
64
+ * the payload (the pdf preview, the `<img>`'s fallback); any other MIME
65
+ * stands the meta card with the `downloadUrl`'s href. Without the member
66
+ * the blocks keep the legacy stand (the bytes over `get`). Rejects an
67
+ * unknown id (the missing's stand). */
68
68
  getMeta?(fileId: string): Promise<BlobMeta>;
69
- /** Optional direct download URL for a file id (the meta card's href — no
70
- * object URL stands). Without the member the download's href stands the
71
- * object URL resolved over `get` (the legacy's path). */
69
+ /** Optional direct URL for a file id (no object URL stands). The image
70
+ * block renders an image MIME straight from it — the browser's own
71
+ * cacheable subrequest instead of the bytes over `get` — and the meta
72
+ * card stands it as the download's href; a store supplies it only when the
73
+ * URL serves the payload inline (a `Content-Disposition: attachment`
74
+ * response serves the download, not the `<img>`). Without the member the
75
+ * download's href stands the object URL resolved over `get` (the
76
+ * legacy's path). */
72
77
  downloadUrl?(fileId: string): string;
73
78
  }
74
79
  /** The default in-memory store: blobs live for the JS session only. */
@@ -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-CfaTBJ85.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-CE8wKsue.mjs";
3
3
  import * as React$1 from "react";
4
4
  import { Component, ComponentType, ErrorInfo, ReactNode } from "react";
5
5
  import { VariantProps } from "class-variance-authority";
@@ -333,12 +333,12 @@ declare const FORMAT_PALETTE: readonly string[];
333
333
  //#region src/attributes/cover-tint.d.ts
334
334
  /**
335
335
  * The stored cover's average color (the frame's tint's / the consumer's
336
- * glow's data's source): the cover's blob resolved over the editor's blob
337
- * store, and the alpha-weighted average read from it — the `rgb(...)`'s
338
- * string or `null` over the absent's id / the unresolved's / the
339
- * undecodable's stand. The blob's identity's cache stands the
340
- * re-resolution's no re-compute (the store's change's new blob stands the
341
- * fresh entry).
336
+ * glow's data's source): the cover's resolved url drawn into the sample's
337
+ * canvas — the `rgb(...)`'s string or `null` over the absent's id / the
338
+ * unresolved's / the undecodable's stand. The resolved url is the store's
339
+ * direct URL when it supplies one; a cross-origin URL without CORS taints
340
+ * the canvas, so that read falls back to the fetched bytes' same-origin
341
+ * object URL (the library's own read).
342
342
  */
343
343
  declare function useCoverAverageColor(): string | null;
344
344
  //#endregion
@@ -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" | "outline" | "secondary" | "custom" | null | undefined;
430
+ variant?: "default" | "destructive" | "custom" | "secondary" | "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" | "outline" | "secondary" | "ghost" | null | undefined;
441
+ variant?: "link" | "default" | "destructive" | "secondary" | "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-DlnrmBT3.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-CfH9kgta.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-DlnrmBT3.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-CfH9kgta.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-CfaTBJ85.mjs";
1
+ import { f as PdfPreviewProps } from "../index-CE8wKsue.mjs";
2
2
  //#region src/pdf/PdfFirstPage.d.ts
3
3
  declare function PdfFirstPage({ id, blockType, url, name }: PdfPreviewProps): import("react").JSX.Element;
4
4
  //#endregion
package/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.21.0",
3
+ "version": "0.23.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",