docblocks-react-ui 0.25.0 → 0.26.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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # docblocks-react-ui
2
2
 
3
+ ## 0.26.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 78e986a: Every page row now stands `data-block-id` and `data-block-type` on its own
8
+ element (`data-slot="docblocks/row"`), in addition to the block's wrapper —
9
+ the block's DOM anchor for navigating to it by id (a table of contents
10
+ scrolling to a heading). The stand holds over the edit's, the view's, and
11
+ the published's renders. The row's anchor is not a block element: the
12
+ selection mapping and the remount's re-seat resolve the block from the
13
+ wrapper (the row's zone — e.g. a form control's focus residue — stands no
14
+ blocks selection over the block).
15
+
3
16
  ## 0.25.0
4
17
 
5
18
  ### Minor Changes
package/README.md CHANGED
@@ -1169,3 +1169,9 @@ Structural styling hooks are `data-slot` attributes (`docblocks/editor`,
1169
1169
  `data-block-type`, `data-list`, `data-depth`, and the per-state attributes — see
1170
1170
  the stylesheet header for the full list. User content styling (run color /
1171
1171
  highlight) is document data, not theme, and is applied inline.
1172
+
1173
+ Block anchors: the block's wrapper (and its inner editable) stand
1174
+ `data-block-id` + `data-block-type`, and every page row stands the same
1175
+ attributes over its own element (`data-slot="docblocks/row"`) — the block's
1176
+ DOM anchor for navigating to it by id (a table of contents scrolling to a
1177
+ heading).
@@ -17178,6 +17178,7 @@ function mapBlocksSelection(root, domSelection, anchorBlock) {
17178
17178
  const range = domSelection.getRangeAt(0);
17179
17179
  const ids = [];
17180
17180
  for (const element of Array.from(root.querySelectorAll("[data-block-id]"))) {
17181
+ if (element.getAttribute("data-slot") === "docblocks/row") continue;
17181
17182
  const blockId = element.dataset.blockId;
17182
17183
  if (ids.includes(blockId)) continue;
17183
17184
  if (range.intersectsNode(element)) ids.push(blockId);
@@ -17379,7 +17380,7 @@ function focusCellActivation(cellId, scope = document) {
17379
17380
  //#region src/editing/block-commands/utils/focus-restore.ts
17380
17381
  /** The parent block id per the DOM: the wrapper above the block's own wrapper; null at the doc root. */
17381
17382
  function domParentBlockIdOf(el) {
17382
- return (el.parentElement?.closest("[data-block-id]"))?.parentElement?.closest("[data-block-id]")?.dataset.blockId ?? null;
17383
+ return (el.parentElement?.closest("[data-block-id]"))?.parentElement?.closest("[data-block-id]:not([data-slot='docblocks/row'])")?.dataset.blockId ?? null;
17383
17384
  }
17384
17385
  /**
17385
17386
  * Whether the candidate inner is the SURVIVOR of the remount, not a framer
@@ -35683,7 +35684,7 @@ function PresenceCaretOverlay({ rootRef }) {
35683
35684
  const next = [];
35684
35685
  for (const peer of presence) {
35685
35686
  for (const point of caretPointsOf(peer.selection)) {
35686
- const block = root.querySelector(`[data-block-id="${CSS.escape(point.blockId)}"][data-slot="docblocks/block-content"]`) ?? root.querySelector(`[data-block-id="${CSS.escape(point.blockId)}"]`);
35687
+ const block = root.querySelector(`[data-block-id="${CSS.escape(point.blockId)}"][data-slot="docblocks/block-content"]`) ?? root.querySelector(`[data-block-id="${CSS.escape(point.blockId)}"]:not([data-slot="docblocks/row"])`);
35687
35688
  if (block === null) continue;
35688
35689
  next.push({
35689
35690
  key: `${peer.peerId}:caret:${point.blockId}:${point.offset}`,
@@ -39297,6 +39298,8 @@ const RowItem = memo(function RowItem({ node, layoutSlide, isDragged, animated,
39297
39298
  as: "div",
39298
39299
  ref: rowRef,
39299
39300
  "data-slot": "docblocks/row",
39301
+ "data-block-id": node.id,
39302
+ "data-block-type": block !== void 0 ? block.type : void 0,
39300
39303
  "data-selected": selected ? "true" : void 0,
39301
39304
  "data-divider": block !== void 0 && block.type === "divider" ? "true" : void 0,
39302
39305
  value: node.id,
package/dist/index.d.mts CHANGED
@@ -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-D91f-KD8.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-DsnFHj1x.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,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-D91f-KD8.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-DsnFHj1x.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/styles.css CHANGED
@@ -542,6 +542,9 @@
542
542
  .block {
543
543
  display: block;
544
544
  }
545
+ .contents {
546
+ display: contents;
547
+ }
545
548
  .flex {
546
549
  display: flex;
547
550
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docblocks-react-ui",
3
- "version": "0.25.0",
3
+ "version": "0.26.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",