docblocks-react-ui 0.4.5 → 0.4.6

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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # docblocks-react-ui
2
2
 
3
+ ## 0.4.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 32128bf: The database grid's column-seam resize locks every column over its
8
+ rendered width for the drag's duration: over a fresh grid (the columns'
9
+ flexible tracks) the first drag's live preview no longer shrinks the
10
+ untouched columns as the dragged column grows — only the dragged column
11
+ moves. The preview's locked layout is exactly the release's commit (the
12
+ untouched columns' start measurement), so the release stands no jump.
13
+
3
14
  ## 0.4.5
4
15
 
5
16
  ### Patch Changes
@@ -9320,14 +9320,16 @@ function useGridColumnDrag({ columns, updateView, tableRef }) {
9320
9320
  //#endregion
9321
9321
  //#region src/database/grid/use-grid-seam-resize.ts
9322
9322
  /** The database grid's column-seam resize: the header cell's right-edge
9323
- * seam's press + drag (the live preview overrides the dragged column's
9324
- * width — no bridge write until the release commits the width), the
9325
- * release (the clamped width commits when it changed — one `updateBlock`,
9326
- * one undo step; the untouched columns stand their measured rendered
9327
- * width, the WYSIWYG lock; a 0 px drag stands a no-op; a stale visible
9328
- * sequence — a peer reordered / hid a column mid-drag — stands no
9329
- * commit), and the cancel. The preview's state stands in the hook (the
9330
- * view reads the dragged column's live width). */
9323
+ * seam's press + drag (the live preview locks every column over its
9324
+ * rendered width — the flexible columns' stand no live shrink, so only
9325
+ * the dragged column moves; no bridge write until the release commits
9326
+ * the widths), the release (the clamped width commits when it changed —
9327
+ * one `updateBlock`, one undo step; the untouched columns stand their
9328
+ * measured rendered width, the WYSIWYG lock — the commit stands the
9329
+ * preview's locked layout exactly; a 0 px drag stands a no-op; a stale
9330
+ * visible sequence — a peer reordered / hid a column mid-drag — stands
9331
+ * no commit), and the cancel. The preview's state stands in the hook (the
9332
+ * view's read of the session's locked widths). */
9331
9333
  function useGridSeamResize({ columns, columnWidths, updateView }) {
9332
9334
  const [resizePreview, setResizePreview] = useState(null);
9333
9335
  const resizeSession = useRef(null);
@@ -9344,22 +9346,34 @@ function useGridSeamResize({ columns, columnWidths, updateView }) {
9344
9346
  const scope = event.currentTarget.closest("[data-slot='docblocks/database']");
9345
9347
  const cells = Array.from(scope?.querySelectorAll("[data-slot='docblocks/database-header-cell']") ?? []);
9346
9348
  const widthsAtStart = columns.map((_, i) => cells[i]?.offsetWidth ?? 0);
9349
+ const widths = columns.map((_, i) => {
9350
+ const measured = widthsAtStart[i] ?? 0;
9351
+ const set = columnWidths?.[i];
9352
+ return Math.max(Math.round(set !== void 0 && set > 0 ? set : measured > 0 ? measured : 112), 50);
9353
+ });
9354
+ widths[col] = Math.max(Math.round(startWidth), 50);
9347
9355
  resizeSession.current = {
9348
9356
  col,
9349
9357
  startX: event.clientX,
9350
9358
  startWidth,
9351
9359
  width: startWidth,
9352
9360
  visible: columns.map((entry) => entry.id),
9353
- widthsAtStart
9361
+ widthsAtStart,
9362
+ widths
9354
9363
  };
9364
+ setResizePreview({
9365
+ col,
9366
+ widths
9367
+ });
9355
9368
  };
9356
9369
  const onSeamPointerMove = (event) => {
9357
9370
  const session = resizeSession.current;
9358
9371
  if (session === null) return;
9359
9372
  session.width = Math.max(Math.round(session.startWidth + (event.clientX - session.startX)), 50);
9373
+ session.widths[session.col] = session.width;
9360
9374
  setResizePreview({
9361
9375
  col: session.col,
9362
- width: session.width
9376
+ widths: session.widths
9363
9377
  });
9364
9378
  };
9365
9379
  /** The seam release: the clamped width commits when it changed (one
@@ -9972,7 +9986,7 @@ function GridBody({ blockId, bridge, tableId, filter, columnOrder, hiddenColumns
9972
9986
  gridTemplateRows: "auto",
9973
9987
  gridAutoRows: "var(--docblocks-database-row-height)",
9974
9988
  gridTemplateColumns: `${columns.map((_, index) => {
9975
- const width = (resizePreview !== null && resizePreview.col === index ? resizePreview.width : void 0) ?? columnWidths?.[index];
9989
+ const width = (resizePreview !== null ? resizePreview.widths[index] : void 0) ?? columnWidths?.[index];
9976
9990
  return width !== void 0 ? `${width}px` : "minmax(7rem, 1fr)";
9977
9991
  }).join(" ")} 2.5rem`
9978
9992
  },
package/dist/index.d.mts CHANGED
@@ -294,7 +294,7 @@ declare function AlertDescription({ className, ...props }: React.ComponentProps<
294
294
  //#endregion
295
295
  //#region src/shared/ui/Badge.d.ts
296
296
  declare const badgeVariants: (props?: ({
297
- variant?: "default" | "destructive" | "outline" | "secondary" | "custom" | null | undefined;
297
+ variant?: "default" | "destructive" | "custom" | "secondary" | "outline" | null | undefined;
298
298
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
299
299
  declare function Badge({ className, variant, asChild, ...props }: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
300
300
  asChild?: boolean;
@@ -305,7 +305,7 @@ declare function BareSelect({ className, children, ...props }: React.ComponentPr
305
305
  //#endregion
306
306
  //#region src/shared/ui/Button.d.ts
307
307
  declare const buttonVariants: (props?: ({
308
- variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
308
+ variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
309
309
  size?: "default" | "icon" | "sm" | "lg" | "xl" | null | undefined;
310
310
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
311
311
  declare function Button({ className, variant, size, asChild, type, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as PopoverHeader, A as SelectTrigger, At as isBridgeErrorCode, B as DropdownMenuRadioGroup, Bt as useMeta, C as SelectContent, Ct as BASELINE_CAPABILITIES, D as SelectScrollDownButton, Dt as BRIDGE_ERROR_CODES, E as SelectLabel, Et as validateProtocolDescriptor, F as DropdownMenuContent, Ft as columnAnnotation, G as DropdownMenuSubContent, Gt as useText, H as DropdownMenuSeparator, Ht as usePresenceSharing, I as DropdownMenuGroup, It as ScrollArea, J as Separator, Jt as blobSubtypeOf, K as DropdownMenuSubTrigger, L as DropdownMenuItem, Lt as Input, M as Label, Mt as conditionMatches, N as DropdownMenu, Nt as parseCellValue, O as SelectScrollUpButton, Ot as BridgeError, P as DropdownMenuCheckboxItem, Pt as TEXT_TYPES, Q as PopoverDescription, R as DropdownMenuLabel, Rt as useBlock, S as Select, St as AlertTitle, T as SelectItem, Tt as isDatabaseBridge, U as DropdownMenuShortcut, Ut as useSelection, V as DropdownMenuRadioItem, Vt as usePresence, W as DropdownMenuSub, Wt as useSelectionView, X as PopoverAnchor, Y as Popover, Yt as createMemoryBlobStore, Z as PopoverContent, _ as FilterBuilder, _t as BareSelect, a as SHAPE_FONT_STACKS, at as CardAction, b as Skeleton, bt as Alert, ct as CardFooter, d as useEditorContext, dt as Pen, et as PopoverTitle, f as DEFAULT_EMBED_SANDBOX, ft as Eye, g as newMutationContext, gt as buttonVariants, h as cellValueEqual, ht as Button, i as SHAPE_FONT_OPTIONS, it as Card, j as SelectValue, jt as toBridgeError, k as SelectSeparator, kt as isBridgeError, l as markToggleAction, lt as CardHeader, m as useDatabaseTable, mt as BookOpen, nt as DocblocksI18nProvider, ot as CardContent, p as GridBody, q as DropdownMenuTrigger, qt as renderRuns, rt as Checkbox, s as FORMAT_PALETTE, st as CardDescription, t as Editor, tt as PopoverTrigger, u as EditorProvider, ut as CardTitle, v as emptyFilter, vt as Badge, w as SelectGroup, wt as PROTOCOL_VERSION, x as SegmentSelector, xt as AlertDescription, y as filterIsComplete, yt as badgeVariants, z as DropdownMenuPortal, zt as useDoc } from "./Editor-B1T7ytNQ.mjs";
1
+ import { $ as PopoverHeader, A as SelectTrigger, At as isBridgeErrorCode, B as DropdownMenuRadioGroup, Bt as useMeta, C as SelectContent, Ct as BASELINE_CAPABILITIES, D as SelectScrollDownButton, Dt as BRIDGE_ERROR_CODES, E as SelectLabel, Et as validateProtocolDescriptor, F as DropdownMenuContent, Ft as columnAnnotation, G as DropdownMenuSubContent, Gt as useText, H as DropdownMenuSeparator, Ht as usePresenceSharing, I as DropdownMenuGroup, It as ScrollArea, J as Separator, Jt as blobSubtypeOf, K as DropdownMenuSubTrigger, L as DropdownMenuItem, Lt as Input, M as Label, Mt as conditionMatches, N as DropdownMenu, Nt as parseCellValue, O as SelectScrollUpButton, Ot as BridgeError, P as DropdownMenuCheckboxItem, Pt as TEXT_TYPES, Q as PopoverDescription, R as DropdownMenuLabel, Rt as useBlock, S as Select, St as AlertTitle, T as SelectItem, Tt as isDatabaseBridge, U as DropdownMenuShortcut, Ut as useSelection, V as DropdownMenuRadioItem, Vt as usePresence, W as DropdownMenuSub, Wt as useSelectionView, X as PopoverAnchor, Y as Popover, Yt as createMemoryBlobStore, Z as PopoverContent, _ as FilterBuilder, _t as BareSelect, a as SHAPE_FONT_STACKS, at as CardAction, b as Skeleton, bt as Alert, ct as CardFooter, d as useEditorContext, dt as Pen, et as PopoverTitle, f as DEFAULT_EMBED_SANDBOX, ft as Eye, g as newMutationContext, gt as buttonVariants, h as cellValueEqual, ht as Button, i as SHAPE_FONT_OPTIONS, it as Card, j as SelectValue, jt as toBridgeError, k as SelectSeparator, kt as isBridgeError, l as markToggleAction, lt as CardHeader, m as useDatabaseTable, mt as BookOpen, nt as DocblocksI18nProvider, ot as CardContent, p as GridBody, q as DropdownMenuTrigger, qt as renderRuns, rt as Checkbox, s as FORMAT_PALETTE, st as CardDescription, t as Editor, tt as PopoverTrigger, u as EditorProvider, ut as CardTitle, v as emptyFilter, vt as Badge, w as SelectGroup, wt as PROTOCOL_VERSION, x as SegmentSelector, xt as AlertDescription, y as filterIsComplete, yt as badgeVariants, z as DropdownMenuPortal, zt as useDoc } from "./Editor-DRvBv_X-.mjs";
2
2
  import { d as cn, l as preventDefault } from "./constants-BaAj3jDA.mjs";
3
3
  import { useCallback, useEffect, useRef, useState } from "react";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,4 +1,4 @@
1
- import { Kt as INLINE_CODE_CLASS, St as AlertTitle, b as Skeleton, bt as Alert, c as textOf, d as useEditorContext, ft as Eye, n as childrenSlot, o as TextBlock, pt as CodeXml, r as CodeHeader, x as SegmentSelector, xt as AlertDescription } from "../Editor-B1T7ytNQ.mjs";
1
+ import { Kt as INLINE_CODE_CLASS, St as AlertTitle, b as Skeleton, bt as Alert, c as textOf, d as useEditorContext, ft as Eye, n as childrenSlot, o as TextBlock, pt as CodeXml, r as CodeHeader, x as SegmentSelector, xt as AlertDescription } from "../Editor-DRvBv_X-.mjs";
2
2
  import { r as TriangleAlert } from "../constants-BaAj3jDA.mjs";
3
3
  import { t as LoaderCircle } from "../LoaderCircle-AGVFE4IP.mjs";
4
4
  import { useEffect, useRef, useState } from "react";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docblocks-react-ui",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "React rendering + editing layer for docblocks: hooks, block renderers, caret/selection, keyboard, clipboard.",
5
5
  "type": "module",
6
6
  "license": "MIT",