docblocks-react-ui 0.4.4 → 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,69 @@
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
+
14
+ ## 0.4.5
15
+
16
+ ### Patch Changes
17
+
18
+ - 468f457: The callout's custom color picker commits the last scrubbed value when
19
+ the picker section closes without an explicit commit (the former close
20
+ discarded the draft); an untouched picker still commits nothing. The
21
+ swatch grid's custom swatch carries the current color when it matches
22
+ no preset (a small dot over the rainbow swatch).
23
+ - 55f51fc: A DOM selection outside a text-editable inside the canvas view maps to
24
+ none over the page's selection mapping. The engine's focus move over a
25
+ canvas item (the mousedown's default focuses the non-editable — the
26
+ firefox's behavior) fires a selectionchange whose blocks mapping would
27
+ flag the focused item: the stray selection tinted the picked shape
28
+ over the canvas' own selection state (the two-click pick's first
29
+ pick). The canvas manages its selection over the explicit press; the
30
+ page card's editable keeps the mapping.
31
+ - 745f1d7: The redo of a remounting step (a type change) restores the pre-change
32
+ selection seat: the redo's stack item carries the pre-undo snapshot,
33
+ which over a remount is the lost-caret residue (none/blocks) rather
34
+ than the pre-change seat. The redo falls back to the seat the matching
35
+ undo restored when the item's own snapshot is not a text selection and
36
+ the undo itself restored a text seat (the remount's case); a non-text
37
+ undo restoration (the canvas' blocks selection) is a legitimate
38
+ pre-undo selection and the redo restores its own snapshot. The view's
39
+ history reseat window suppresses the remount's transient selection loss
40
+ over the undo/redo, and the reseat re-runs when the restoration's
41
+ emission lands.
42
+ - 7bc9512: The shared popover's enter and exit animations now run: the classes were
43
+ keyed on `data-open` / `data-closed` attributes that Radix does not set
44
+ (it sets `data-state="open" | "closed"`), so the animations never applied
45
+ and the content teleported in. The closed content now gets
46
+ `pointer-events-none` for the exit animation, so a fading popover does
47
+ not swallow the press landing over its area.
48
+ - 00d4596: The canvas connector's line is clickable in webkit (Safari): the wide
49
+ invisible hit path renders in its own svg sized to the path's bounding
50
+ box over the 1x1 center-anchor draw layer. The webkit hit-tests only
51
+ inside an svg's own box (the overflow-visible content of the 1x1 layer
52
+ is draw-only there), so the line was not selectable by a click over
53
+ there. The chromium and the firefox reach the overflow, so the box
54
+ change alters no behavior over them.
55
+ - 4e1bee5: The cross-block selection stands over the engines that clamp the DOM
56
+ selection across contenteditable boundaries (webkit / Safari): the
57
+ selection writes (the keyboard extension, the drag's seat) use a
58
+ document-ordered Range instead of the Selection endpoint setters (the
59
+ clamping writes), and the cross-block reads (the arrow at the text's
60
+ edge, the range's extension) use the range's far endpoint when the
61
+ selection's focus reads clamped into the anchor's editable. The
62
+ selection's mapping reads the cross-editable range from its endpoints
63
+ instead of the anchor / focus nodes.
64
+ - Updated dependencies [745f1d7]
65
+ - docblocks-core@0.2.2
66
+
3
67
  ## 0.4.4
4
68
 
5
69
  ### Patch Changes
@@ -850,6 +850,42 @@ function selectionOrphaned() {
850
850
  const node = selection.getRangeAt(0).startContainer;
851
851
  return node !== document && !document.contains(node);
852
852
  }
853
+ /**
854
+ * The selection's focus end as the editor reads it: the engine's
855
+ * `focusNode` / `focusOffset` — except when the range crosses a
856
+ * contenteditable boundary and the focus reads back inside the anchor's
857
+ * own editable (the webkit's clamped focus read-back: the engine clamps
858
+ * the far endpoint there, so the anchor/focus pair cannot express the
859
+ * cross range). The range's endpoints stand the derivation then: the
860
+ * engine's range is faithful across the boundary even when the
861
+ * anchor/focus read-back is not. The direction is the range's (the
862
+ * clamped engine's anchor reads as the range's start) — the focus end is
863
+ * the range's far endpoint over the anchor's, whatever its order.
864
+ */
865
+ function effectiveFocusEnd(domSelection) {
866
+ if (domSelection.rangeCount === 0) return null;
867
+ const { anchorNode, anchorOffset, focusNode, focusOffset } = domSelection;
868
+ if (focusNode === null || anchorNode === null) return null;
869
+ const range = domSelection.getRangeAt(0);
870
+ const anchorEditable = editableOfNode$1(anchorNode);
871
+ const startEditable = editableOfNode$1(range.startContainer);
872
+ const endEditable = range.startContainer === range.endContainer ? startEditable : editableOfNode$1(range.endContainer);
873
+ if (startEditable !== null && endEditable !== null && startEditable !== endEditable && anchorEditable !== null && anchorEditable.contains(focusNode)) return range.startContainer === anchorNode && range.startOffset === anchorOffset ? {
874
+ node: range.endContainer,
875
+ offset: range.endOffset
876
+ } : {
877
+ node: range.startContainer,
878
+ offset: range.startOffset
879
+ };
880
+ return {
881
+ node: focusNode,
882
+ offset: focusOffset
883
+ };
884
+ }
885
+ /** The contenteditable that owns a node (the node's element or its parent's), or null. */
886
+ function editableOfNode$1(node) {
887
+ return (node === null ? null : node.nodeType === Node.ELEMENT_NODE ? node : node.parentElement)?.closest("[contenteditable=\"true\"]") ?? null;
888
+ }
853
889
  //#endregion
854
890
  //#region src/editing/block-commands/utils/focus.ts
855
891
  /** Run `fn` in the next animation frame (setTimeout where frames do not exist). */
@@ -957,9 +993,13 @@ function seatedIn(el) {
957
993
  * the user's and stops the watch — it is never clobbered. The offsets are
958
994
  * the gesture's pre-move ones: a structural gesture never edits the
959
995
  * block's text, so they remain valid. `scope` confines the lookup to one
960
- * editor root (a page can render the same doc in several).
996
+ * editor root (a page can render the same doc in several). The deadline
997
+ * stands the remount's commit window over the engine's scheduling (the
998
+ * firefox's engine commits the remount slower over the load) — the watch
999
+ * stops at the first seated attempt or the user's selection, so the
1000
+ * length is the residue's watch lifetime only.
961
1001
  */
962
- const RESTORE_DEADLINE_MS = 600;
1002
+ const RESTORE_DEADLINE_MS = 2e3;
963
1003
  function restoreSelectionIn(doc, blockId, from, to, scope = document, exclude = null) {
964
1004
  const selector = `[data-block-id="${CSS.escape(blockId)}"][data-slot="docblocks/block-content"]`;
965
1005
  const json = doc.toJSON();
@@ -1028,6 +1068,40 @@ function reseatHistorySelection(doc, view, scope = document) {
1028
1068
  restoreSelectionIn(doc, from.blockId, from.offset, to === null ? null : to.offset, scope);
1029
1069
  }
1030
1070
  /**
1071
+ * Stand a DOM selection over (base, focus) — across the contenteditable
1072
+ * boundary included: the selection is built as one document-ordered Range
1073
+ * and added whole. The engine's `setBaseAndExtent` / `extend` cannot put an
1074
+ * endpoint in ANOTHER editable — the webkit clamps the far endpoint to the
1075
+ * anchor's own editable (the call stands, the range does not cross); the
1076
+ * Range's endpoints are faithful across the boundary. The anchor/focus
1077
+ * READ-BACK may still be clamped in that engine — the mapping's stand
1078
+ * (`selection-mapping`'s cross-editable branch) reads the range there.
1079
+ * The direction's read-back stands the range's (the anchor reads as the
1080
+ * range's start): the core model is document-ordered, so the direction
1081
+ * carries no behavior.
1082
+ */
1083
+ function applyDomSelection(baseNode, baseOffset, focusNode, focusOffset) {
1084
+ const selection = window.getSelection();
1085
+ if (selection === null) return;
1086
+ const baseProbe = document.createRange();
1087
+ baseProbe.setStart(baseNode, baseOffset);
1088
+ baseProbe.collapse(true);
1089
+ const focusProbe = document.createRange();
1090
+ focusProbe.setStart(focusNode, focusOffset);
1091
+ focusProbe.collapse(true);
1092
+ const baseFirst = baseProbe.compareBoundaryPoints(Range.END_TO_START, focusProbe) <= 0;
1093
+ const range = document.createRange();
1094
+ if (baseFirst) {
1095
+ range.setStart(baseNode, baseOffset);
1096
+ range.setEnd(focusNode, focusOffset);
1097
+ } else {
1098
+ range.setStart(focusNode, focusOffset);
1099
+ range.setEnd(baseNode, baseOffset);
1100
+ }
1101
+ selection.removeAllRanges();
1102
+ selection.addRange(range);
1103
+ }
1104
+ /**
1031
1105
  * Re-base the browser's selection anchor at (anchorNode, anchorOffset) and
1032
1106
  * put the focus end at the flat offset in the target block (DOM-only: the
1033
1107
  * doc is untouched). The browser's shift+arrow cannot cross a contenteditable
@@ -1039,12 +1113,10 @@ function reseatHistorySelection(doc, view, scope = document) {
1039
1113
  * selection, not the focus. A no-op when the target element is not rendered.
1040
1114
  */
1041
1115
  function extendSelectionTo(anchorNode, anchorOffset, blockId, offset) {
1042
- const domSelection = window.getSelection();
1043
- if (domSelection === null) return;
1044
1116
  const el = editorRootOf(anchorNode).querySelector(`[data-block-id="${CSS.escape(blockId)}"][data-slot="docblocks/block-content"]`);
1045
1117
  if (el === null) return;
1046
1118
  const target = locatePosition(el, offset);
1047
- domSelection.setBaseAndExtent(anchorNode, anchorOffset, target.node, target.offset);
1119
+ applyDomSelection(anchorNode, anchorOffset, target.node, target.offset);
1048
1120
  }
1049
1121
  //#endregion
1050
1122
  //#region src/editing/slash/context.ts
@@ -5041,12 +5113,14 @@ function DocblocksI18nProvider({ children }) {
5041
5113
  /**
5042
5114
  * The custom color's picker body (the callout menu's custom swatch opens it
5043
5115
  * as an inline section): the native `input type="color"` (the live scrub —
5044
- * no doc write) and the hex field (the strict `#rrggbb`). The doc write
5045
- * stands one `onCommit` per pick (one undo step, one wire update — the
5046
- * swatch pick's parity): the native dialog's commit (`change`), the field's
5047
- * valid Enter / blur. An invalid field value resets to the draft on blur
5048
- * (the picker stands the last valid stand). The close without a commit
5049
- * (the cancel) discards the draft — the menu's unmount stands it.
5116
+ * no doc write over the scrub) and the hex field (the strict `#rrggbb`).
5117
+ * The doc write stands one `onCommit` per pick (one undo step, one wire
5118
+ * update — the swatch pick's parity): the native dialog's commit (`change`),
5119
+ * the field's valid Enter / blur. An invalid field value resets to the
5120
+ * draft on blur (the picker stands the last valid stand). The close without
5121
+ * an explicit commit (the Esc / the toggle / the menu's dismiss) commits the
5122
+ * last scrubbed value (the picker's unmount commits it); an untouched
5123
+ * picker commits nothing.
5050
5124
  */
5051
5125
  /** The absent value's stand: the native input's neutral default. */
5052
5126
  const DEFAULT_HEX = "#808080";
@@ -5062,11 +5136,24 @@ function ColorPickerInner({ value, onCommit, onClose }) {
5062
5136
  onCommitRef.current = onCommit;
5063
5137
  const onCloseRef = useRef(onClose);
5064
5138
  onCloseRef.current = onClose;
5139
+ const draftRef = useRef(draft);
5140
+ draftRef.current = draft;
5141
+ const touchedRef = useRef(false);
5142
+ const committedRef = useRef(false);
5143
+ useEffect(() => {
5144
+ return () => {
5145
+ if (!touchedRef.current || committedRef.current) return;
5146
+ const committed = normalizeHex$1(draftRef.current);
5147
+ const current = valueRef.current === null ? null : normalizeHex$1(valueRef.current);
5148
+ if (committed !== null && committed !== current) onCommitRef.current(committed);
5149
+ };
5150
+ }, []);
5065
5151
  const nativeRef = useRef(null);
5066
5152
  useEffect(() => {
5067
5153
  const el = nativeRef.current;
5068
5154
  if (el === null) return;
5069
5155
  const onChange = (event) => {
5156
+ committedRef.current = true;
5070
5157
  const committed = normalizeHex$1(event.target.value);
5071
5158
  const current = valueRef.current === null ? null : normalizeHex$1(valueRef.current);
5072
5159
  if (committed !== null && committed !== current) onCommitRef.current(committed);
@@ -5079,6 +5166,7 @@ function ColorPickerInner({ value, onCommit, onClose }) {
5079
5166
  const commitField = (raw) => {
5080
5167
  const match = raw.trim().match(STRICT_HEX_RE);
5081
5168
  if (match === null) return false;
5169
+ committedRef.current = true;
5082
5170
  const hex = `#${match[1].toLowerCase()}`;
5083
5171
  setDraft(hex);
5084
5172
  setField(hex);
@@ -5092,7 +5180,10 @@ function ColorPickerInner({ value, onCommit, onClose }) {
5092
5180
  ref: nativeRef,
5093
5181
  type: "color",
5094
5182
  value: draft,
5095
- onInput: (event) => setDraft(event.currentTarget.value),
5183
+ onInput: (event) => {
5184
+ touchedRef.current = true;
5185
+ setDraft(event.currentTarget.value);
5186
+ },
5096
5187
  "aria-label": t("colorPicker.aria"),
5097
5188
  className: "h-8 w-8 cursor-pointer rounded-xs border border-(--border) bg-transparent p-0.5"
5098
5189
  }), /* @__PURE__ */ jsx(Input, {
@@ -5135,7 +5226,10 @@ function ColorPicker(props) {
5135
5226
  * Two opt-in extras (off by default): the transparent ("no color") swatch
5136
5227
  * (a theme-background circle crossed by a thin `--destructive` line —
5137
5228
  * reports `onSelectNone`) and the custom swatch (a rainbow circle that
5138
- * reports `onCustom`; the full picker it opens is built on first use).
5229
+ * reports `onCustom`; the full picker it opens is built on first use). A
5230
+ * current value that matches no entry (a non-preset custom color) shows a
5231
+ * small dot of its own over the custom swatch — the row's highlight shows
5232
+ * a preset's match only, so the dot is the custom value's marker.
5139
5233
  */
5140
5234
  /** The palette's i18n scope: the package's instance stands the provider's
5141
5235
  * seat over the palette (the primitive stands also outside the editor's
@@ -5161,6 +5255,8 @@ function ColorSwatchesInner({ colors, current, onSelect, label, allowNone = fals
5161
5255
  if (currentHex === null) return false;
5162
5256
  return (normalizeHex$1(entry) ?? resolved[index] ?? null) === currentHex;
5163
5257
  };
5258
+ const currentHex = current === null || current === void 0 ? null : normalizeHex$1(current);
5259
+ const customCarriesCurrent = allowCustom && currentHex !== null && !colors.some((entry, index) => (normalizeHex$1(entry) ?? resolved[index] ?? null) === currentHex);
5164
5260
  const selectSwatch = (entry) => (event) => {
5165
5261
  const hex = resolveColorToHex(entry, event.currentTarget);
5166
5262
  if (hex !== null) onSelect(hex);
@@ -5214,9 +5310,15 @@ function ColorSwatchesInner({ colors, current, onSelect, label, allowNone = fals
5214
5310
  "data-color": "custom",
5215
5311
  "aria-label": t("common:color.custom"),
5216
5312
  title: t("common:color.custom"),
5217
- className: "size-5 rounded-full border border-(--border) transition-none",
5313
+ className: "relative size-5 rounded-full border border-(--border) transition-none",
5218
5314
  style: { background: "conic-gradient(red, orange, yellow, green, cyan, blue, magenta, red)" },
5219
- onClick: onCustom
5315
+ onClick: onCustom,
5316
+ children: customCarriesCurrent && currentHex !== null && /* @__PURE__ */ jsx("span", {
5317
+ "aria-hidden": true,
5318
+ "data-slot": "docblocks/palette-custom-current",
5319
+ className: "\n absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border border-(--border)\n ",
5320
+ style: { background: currentHex }
5321
+ })
5220
5322
  })
5221
5323
  ]
5222
5324
  });
@@ -5244,12 +5346,13 @@ function PopoverContent({ className, align = "center", sideOffset = 4, ...props
5244
5346
  pointer-events-auto z-modal flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5
5245
5347
  rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10
5246
5348
  outline-hidden duration-100
5247
- data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95
5248
- data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95
5249
5349
  data-[side=bottom]:slide-in-from-top-2
5250
5350
  data-[side=left]:slide-in-from-right-2
5251
5351
  data-[side=right]:slide-in-from-left-2
5252
5352
  data-[side=top]:slide-in-from-bottom-2
5353
+ data-[state=closed]:pointer-events-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0
5354
+ data-[state=closed]:zoom-out-95
5355
+ data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95
5253
5356
  `, className),
5254
5357
  ...props
5255
5358
  }) });
@@ -9217,14 +9320,16 @@ function useGridColumnDrag({ columns, updateView, tableRef }) {
9217
9320
  //#endregion
9218
9321
  //#region src/database/grid/use-grid-seam-resize.ts
9219
9322
  /** The database grid's column-seam resize: the header cell's right-edge
9220
- * seam's press + drag (the live preview overrides the dragged column's
9221
- * width — no bridge write until the release commits the width), the
9222
- * release (the clamped width commits when it changed — one `updateBlock`,
9223
- * one undo step; the untouched columns stand their measured rendered
9224
- * width, the WYSIWYG lock; a 0 px drag stands a no-op; a stale visible
9225
- * sequence — a peer reordered / hid a column mid-drag — stands no
9226
- * commit), and the cancel. The preview's state stands in the hook (the
9227
- * 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). */
9228
9333
  function useGridSeamResize({ columns, columnWidths, updateView }) {
9229
9334
  const [resizePreview, setResizePreview] = useState(null);
9230
9335
  const resizeSession = useRef(null);
@@ -9241,22 +9346,34 @@ function useGridSeamResize({ columns, columnWidths, updateView }) {
9241
9346
  const scope = event.currentTarget.closest("[data-slot='docblocks/database']");
9242
9347
  const cells = Array.from(scope?.querySelectorAll("[data-slot='docblocks/database-header-cell']") ?? []);
9243
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);
9244
9355
  resizeSession.current = {
9245
9356
  col,
9246
9357
  startX: event.clientX,
9247
9358
  startWidth,
9248
9359
  width: startWidth,
9249
9360
  visible: columns.map((entry) => entry.id),
9250
- widthsAtStart
9361
+ widthsAtStart,
9362
+ widths
9251
9363
  };
9364
+ setResizePreview({
9365
+ col,
9366
+ widths
9367
+ });
9252
9368
  };
9253
9369
  const onSeamPointerMove = (event) => {
9254
9370
  const session = resizeSession.current;
9255
9371
  if (session === null) return;
9256
9372
  session.width = Math.max(Math.round(session.startWidth + (event.clientX - session.startX)), 50);
9373
+ session.widths[session.col] = session.width;
9257
9374
  setResizePreview({
9258
9375
  col: session.col,
9259
- width: session.width
9376
+ widths: session.widths
9260
9377
  });
9261
9378
  };
9262
9379
  /** The seam release: the clamped width commits when it changed (one
@@ -9869,7 +9986,7 @@ function GridBody({ blockId, bridge, tableId, filter, columnOrder, hiddenColumns
9869
9986
  gridTemplateRows: "auto",
9870
9987
  gridAutoRows: "var(--docblocks-database-row-height)",
9871
9988
  gridTemplateColumns: `${columns.map((_, index) => {
9872
- 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];
9873
9990
  return width !== void 0 ? `${width}px` : "minmax(7rem, 1fr)";
9874
9991
  }).join(" ")} 2.5rem`
9875
9992
  },
@@ -11993,7 +12110,10 @@ function EditorProviderStand({ doc, provider, blockRenderers, blobResolver, blob
11993
12110
  const [store] = useState(() => createEditorStore(doc, rootId));
11994
12111
  const docRef = useRef(doc);
11995
12112
  const rootIdRef = useRef(rootId);
11996
- const selectionRef = useRef({ view: null });
12113
+ const selectionRef = useRef({
12114
+ view: null,
12115
+ reseatUntil: { current: 0 }
12116
+ });
11997
12117
  const parentContext = useContext(EditorContext);
11998
12118
  const effectiveAccessLevel = accessLevel ?? parentContext?.accessLevel ?? "editor";
11999
12119
  const effectiveMode = effectiveAccessLevel === "viewer" ? "published" : mode ?? parentContext?.mode ?? "edit";
@@ -16029,8 +16149,12 @@ function extendRangeFocusEnd(doc, selection, key) {
16029
16149
  if (selection.kind !== "text" || selection.to === null) return false;
16030
16150
  const domSelection = window.getSelection();
16031
16151
  if (domSelection === null || domSelection.rangeCount === 0) return false;
16032
- const { anchorNode, anchorOffset, focusNode, focusOffset } = domSelection;
16033
- if (anchorNode === null || focusNode === null) return false;
16152
+ const { anchorNode, anchorOffset } = domSelection;
16153
+ if (anchorNode === null) return false;
16154
+ const effective = effectiveFocusEnd(domSelection);
16155
+ if (effective === null) return false;
16156
+ const focusNode = effective.node;
16157
+ const focusOffset = effective.offset;
16034
16158
  const scope = editorRootOf(focusNode);
16035
16159
  const focusBlock = textBlockOfNode(focusNode);
16036
16160
  if (focusBlock === null) return false;
@@ -16079,7 +16203,7 @@ function extendRangeFocusEnd(doc, selection, key) {
16079
16203
  const target = scope.querySelector(`[data-block-id="${CSS.escape(next.blockId)}"][data-slot="docblocks/block-content"]`);
16080
16204
  if (target === null) return false;
16081
16205
  const position = locatePosition(target, next.offset);
16082
- domSelection.setBaseAndExtent(anchorNode, anchorOffset, position.node, position.offset);
16206
+ applyDomSelection(anchorNode, anchorOffset, position.node, position.offset);
16083
16207
  return true;
16084
16208
  }
16085
16209
  //#endregion
@@ -16123,6 +16247,36 @@ function mapDomSelection(root, domSelection, doc) {
16123
16247
  const range = domSelection.getRangeAt(0);
16124
16248
  const anchorBlock = textBlockOf(anchorNode, root);
16125
16249
  const focusBlock = textBlockOf(focusNode, root);
16250
+ if ((anchorNode instanceof Element ? anchorNode : anchorNode.parentElement ?? null)?.closest("[data-slot=\"docblocks/canvas-view\"]") !== null && anchorBlock === null && editableOfNode(anchorNode) === null) return { kind: "none" };
16251
+ const startEditable = editableOfNode(range.startContainer);
16252
+ const endEditable = range.startContainer === range.endContainer ? startEditable : editableOfNode(range.endContainer);
16253
+ if (startEditable !== null && endEditable !== null && startEditable !== endEditable) {
16254
+ const first = {
16255
+ node: range.startContainer,
16256
+ offset: range.startOffset,
16257
+ textBlock: textBlockOf(range.startContainer, root)
16258
+ };
16259
+ const last = {
16260
+ node: range.endContainer,
16261
+ offset: range.endOffset,
16262
+ textBlock: textBlockOf(range.endContainer, root)
16263
+ };
16264
+ if (first.textBlock === null && last.textBlock === null && !rangeTouchesTextBlock(root, range)) return mapBlocksSelection(root, domSelection, anchorBlock);
16265
+ const from = resolveEndpoint(doc, root, first, "first");
16266
+ const to = resolveEndpoint(doc, root, last, "last");
16267
+ if (from === null || to === null) return mapBlocksSelection(root, domSelection, anchorBlock);
16268
+ if (from.blockId === to.blockId && from.offset === to.offset) return {
16269
+ kind: "text",
16270
+ from,
16271
+ to: null
16272
+ };
16273
+ return {
16274
+ kind: "text",
16275
+ from,
16276
+ to,
16277
+ ...!(range.startContainer === anchorNode && range.startOffset === anchorOffset) ? { reverse: true } : {}
16278
+ };
16279
+ }
16126
16280
  if (anchorBlock !== null && focusBlock === anchorBlock) return mapTextSelection(anchorBlock, anchorNode, anchorOffset, focusNode, focusOffset);
16127
16281
  const anchorIsFirst = range.startContainer === anchorNode && range.startOffset === anchorOffset;
16128
16282
  const first = {
@@ -16340,11 +16494,13 @@ function syncDomSelection(root, doc, view) {
16340
16494
  * not — the mapping must not clobber a `blocks` view there.
16341
16495
  */
16342
16496
  function domSelectionInEditable(domSelection) {
16343
- if (domSelection === null || domSelection.rangeCount === 0) return false;
16344
- const elementOf = (node) => node instanceof Element ? node : node === null ? null : node.parentElement;
16345
- const anchor = elementOf(domSelection.anchorNode);
16346
- const focus = elementOf(domSelection.focusNode);
16347
- return anchor?.closest("[contenteditable=\"true\"]") !== null && focus?.closest("[contenteditable=\"true\"]") !== null;
16497
+ const anchor = editableOfNode(domSelection?.anchorNode ?? null);
16498
+ const focus = editableOfNode(domSelection?.focusNode ?? null);
16499
+ return anchor !== null && focus !== null;
16500
+ }
16501
+ /** The contenteditable that owns a node (the node's element or its parent's), or null. */
16502
+ function editableOfNode(node) {
16503
+ return (node === null ? null : node.nodeType === Node.ELEMENT_NODE ? node : node.parentElement)?.closest("[contenteditable=\"true\"]") ?? null;
16348
16504
  }
16349
16505
  //#endregion
16350
16506
  //#region src/editing/cross-range-keys.ts
@@ -16376,6 +16532,13 @@ function handleCrossRangeKey(doc, view, selection, root, event) {
16376
16532
  if (moved) syncDomSelection(root, doc, view);
16377
16533
  return true;
16378
16534
  }
16535
+ if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
16536
+ const domSelection = window.getSelection();
16537
+ if (domSelection === null || domSelection.rangeCount === 0 || domSelection.focusNode === null) return false;
16538
+ event.preventDefault();
16539
+ domSelection.collapse(domSelection.focusNode, domSelection.focusOffset);
16540
+ return true;
16541
+ }
16379
16542
  if (event.key === "Delete" || event.key === "Backspace") {
16380
16543
  event.preventDefault();
16381
16544
  const result = doc.deleteTextRange(selection.from, selection.to);
@@ -17002,7 +17165,9 @@ function useBlockInput({ id, blockType, context, innerRef, wrapperRef, declareLo
17002
17165
  const domSelection = window.getSelection();
17003
17166
  if (selection.kind !== "blocks" && mappedRoot instanceof HTMLElement && domSelection !== null) {
17004
17167
  const fresh = mapDomSelection(mappedRoot, domSelection, doc);
17005
- if (!selectionsEqual(fresh, selection)) view.set(fresh);
17168
+ if (!selectionsEqual(fresh, selection)) {
17169
+ if (!(fresh.kind !== "text" && Date.now() < selectionRef.reseatUntil.current)) view.set(fresh);
17170
+ }
17006
17171
  selection = view.get();
17007
17172
  root = mappedRoot;
17008
17173
  }
@@ -17152,7 +17317,17 @@ function useBlockInput({ id, blockType, context, innerRef, wrapperRef, declareLo
17152
17317
  const domSelection = window.getSelection();
17153
17318
  if (domSelection === null || domSelection.rangeCount === 0 || !domSelection.isCollapsed) return;
17154
17319
  if (domSelection.anchorNode === null || !inner.contains(domSelection.anchorNode)) return;
17155
- if (caretOffsetIn(inner, domSelection.anchorNode, domSelection.anchorOffset) !== 0) return;
17320
+ const offset = caretOffsetIn(inner, domSelection.anchorNode, domSelection.anchorOffset);
17321
+ if (offset !== 0) {
17322
+ const text = doc.getText(id);
17323
+ if (offset === text.length && text.endsWith("\n")) {
17324
+ event.preventDefault();
17325
+ doc.deleteText(id, offset - 1, offset);
17326
+ focusCaretIn(id, offset - 1, editorRootOf(inner));
17327
+ return;
17328
+ }
17329
+ return;
17330
+ }
17156
17331
  if (inCell) return;
17157
17332
  if ((blockType === "quote" || blockType === "callout" || blockType === "code") && doc.getTextLength(id) > 0) return;
17158
17333
  const merged = mergeWithPrevious(doc, id, context.parentId);
@@ -17388,8 +17563,12 @@ function useBlockKeyboard({ id, blockType, context, innerRef }) {
17388
17563
  if (selectionRef.view?.get().kind === "blocks") return;
17389
17564
  const domSelection = window.getSelection();
17390
17565
  if (domSelection === null || domSelection.rangeCount === 0) return;
17391
- const { anchorNode, anchorOffset, focusNode, focusOffset } = domSelection;
17392
- if (anchorNode === null || focusNode === null) return;
17566
+ const { anchorNode, anchorOffset } = domSelection;
17567
+ if (anchorNode === null) return;
17568
+ const effective = effectiveFocusEnd(domSelection);
17569
+ if (effective === null) return;
17570
+ const focusNode = effective.node;
17571
+ const focusOffset = effective.offset;
17393
17572
  const focusBlock = textBlockOfNode(focusNode);
17394
17573
  if (focusBlock === null) return;
17395
17574
  const focusBlockId = focusBlock.dataset.blockId;
@@ -17580,11 +17759,14 @@ function useTextInner({ id, block, blockType, context, wrapperRef }) {
17580
17759
  if (!startInside && !endInside) return;
17581
17760
  const from = caretOffsetIn(el, range.startContainer, range.startOffset);
17582
17761
  const to = caretOffsetIn(el, range.endContainer, range.endOffset);
17762
+ const farContainer = startInside ? range.endContainer : range.startContainer;
17763
+ const farBlockId = (farContainer.nodeType === Node.TEXT_NODE ? farContainer.parentElement : farContainer)?.closest("[data-block-id]")?.getAttribute("data-block-id") ?? null;
17583
17764
  const crossCapture = () => ({
17584
17765
  startIsLocal: startInside,
17585
17766
  localOffset: startInside ? from : to,
17586
- farNode: startInside ? range.endContainer : range.startContainer,
17587
- farOffset: startInside ? range.endOffset : range.startOffset
17767
+ farNode: farContainer,
17768
+ farOffset: startInside ? range.endOffset : range.startOffset,
17769
+ farBlockId
17588
17770
  });
17589
17771
  if (nextText === prevText) {
17590
17772
  if (startInside && endInside) {
@@ -17638,16 +17820,26 @@ function useTextInner({ id, block, blockType, context, wrapperRef }) {
17638
17820
  renderRunsInto(pending.runs, el);
17639
17821
  appliedRef.current = block;
17640
17822
  if ("cross" in pending) {
17823
+ const cross = pending.cross;
17824
+ let farNode = cross.farNode;
17825
+ let farOffset = cross.farOffset;
17826
+ if (!document.contains(farNode) && cross.farBlockId !== null) {
17827
+ const farInner = (el.closest("[data-slot=\"docblocks/editor\"]") ?? document).querySelector(`[data-block-id="${CSS.escape(cross.farBlockId)}"][data-slot="docblocks/block-content"]`);
17828
+ if (farInner !== null) {
17829
+ const remap = locatePosition(farInner, cross.farOffset);
17830
+ farNode = remap.node;
17831
+ farOffset = remap.offset;
17832
+ }
17833
+ }
17641
17834
  const selection = window.getSelection();
17642
- if (selection !== null && selection.rangeCount > 0 && (selection.containsNode(pending.cross.farNode, true) || selectionOrphaned()) && document.contains(pending.cross.farNode)) {
17643
- const local = locatePosition(el, pending.cross.localOffset);
17644
- const cross = pending.cross;
17835
+ if (selection !== null && selection.rangeCount > 0 && (selection.containsNode(farNode, true) || selectionOrphaned()) && document.contains(farNode)) {
17836
+ const local = locatePosition(el, cross.localOffset);
17645
17837
  const range = document.createRange();
17646
17838
  if (cross.startIsLocal) {
17647
17839
  range.setStart(local.node, local.offset);
17648
- range.setEnd(cross.farNode, cross.farOffset);
17840
+ range.setEnd(farNode, farOffset);
17649
17841
  } else {
17650
- range.setStart(cross.farNode, cross.farOffset);
17842
+ range.setStart(farNode, farOffset);
17651
17843
  range.setEnd(local.node, local.offset);
17652
17844
  }
17653
17845
  selection.removeAllRanges();
@@ -18336,8 +18528,10 @@ function calloutIconName(icon, variant) {
18336
18528
  * focus stands the gesture). The pick's stand closes the menu over the
18337
18529
  * color and the icon's apply (the type preset stays open). The custom
18338
18530
  * swatch's press toggles the picker's inline section over the menu's
18339
- * background row; the close without a commit (the cancel) discards the
18340
- * draft — the menu's unmount stands it.
18531
+ * background row; a close without an explicit commit (the Esc / the
18532
+ * dismiss) applies the last scrubbed value (the picker's unmount commits
18533
+ * it; the grid's custom swatch carries a non-preset current value as its
18534
+ * own dot).
18341
18535
  */
18342
18536
  function CalloutBlockMenu({ id, block }) {
18343
18537
  const { t } = useTranslation("editor");
@@ -19378,7 +19572,11 @@ const CanvasSessionContext = createContext({
19378
19572
  * `interactive` toggles the hit path: the canvas view is interactive
19379
19573
  * (the line is selectable, the endpoints draggable), the page view's
19380
19574
  * embedded surface stands it inert (no selection / dragging there — the
19381
- * bands must not intercept the content's clicks).
19575
+ * bands must not intercept the content's clicks). The hit path's `d`
19576
+ * is returned alongside the content: the hit path renders in its own
19577
+ * bbox-sized svg — the webkit does not hit-test the overflow-visible
19578
+ * content over the 1x1 svg's box, so the line is not clickable from
19579
+ * there without the box.
19382
19580
  */
19383
19581
  function connectorLineOf(surfaceId, connectorId, block, childIds, blocks, selected, interactive, session) {
19384
19582
  const attrs = block.attrs;
@@ -19530,8 +19728,8 @@ function connectorLineOf(surfaceId, connectorId, block, childIds, blocks, select
19530
19728
  })]
19531
19729
  }) : null;
19532
19730
  const pathStyle = { stroke };
19533
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
19534
- /* @__PURE__ */ jsx("path", {
19731
+ return {
19732
+ content: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("path", {
19535
19733
  "data-connector-id": connectorId,
19536
19734
  "data-selected": selected || void 0,
19537
19735
  d: path,
@@ -19542,18 +19740,36 @@ function connectorLineOf(surfaceId, connectorId, block, childIds, blocks, select
19542
19740
  strokeDasharray: dash,
19543
19741
  strokeLinecap: attrs.strokeStyle === "dot" ? "round" : void 0,
19544
19742
  style: pathStyle
19545
- }),
19546
- interactive && /* @__PURE__ */ jsx("path", {
19547
- "data-connector-hit": connectorId,
19548
- d: path,
19549
- stroke: "transparent",
19550
- strokeWidth: 12,
19551
- fill: "none",
19552
- pointerEvents: "stroke",
19553
- className: "cursor-pointer"
19554
- }),
19555
- snapBadge
19556
- ] });
19743
+ }), snapBadge] }),
19744
+ hitD: interactive ? path : null
19745
+ };
19746
+ }
19747
+ /** The path's points' bounding box (the surface's center-anchor space):
19748
+ * the `d`'s M/L's coordinates (the plain numbers' parse — the builder's
19749
+ * template's format). The hit path's svg box must contain the stroke:
19750
+ * the webkit hit-tests only inside the svg's own box, so the hit path
19751
+ * needs a bbox-sized svg over the 1x1 draw layer (draw-only there). */
19752
+ function hitBoxOf(d) {
19753
+ const numbers = d.replace(/[A-Za-z]/g, " ").split(/\s+/).map(Number.parseFloat).filter((value) => Number.isFinite(value));
19754
+ if (numbers.length < 4) return null;
19755
+ let minX = Infinity;
19756
+ let minY = Infinity;
19757
+ let maxX = -Infinity;
19758
+ let maxY = -Infinity;
19759
+ for (let i = 0; i < numbers.length; i += 2) {
19760
+ const x = numbers[i] ?? 0;
19761
+ const y = numbers[i + 1] ?? 0;
19762
+ minX = Math.min(minX, x);
19763
+ minY = Math.min(minY, y);
19764
+ maxX = Math.max(maxX, x);
19765
+ maxY = Math.max(maxY, y);
19766
+ }
19767
+ return {
19768
+ x: minX,
19769
+ y: minY,
19770
+ w: maxX - minX,
19771
+ h: maxY - minY
19772
+ };
19557
19773
  }
19558
19774
  /**
19559
19775
  * One connector's line, the surface's Z-ORDER stand (the explicit zIndex):
@@ -19565,9 +19781,12 @@ function connectorLineOf(surfaceId, connectorId, block, childIds, blocks, select
19565
19781
  * CanvasItem's wrapper stands at the surface's origin), the shared
19566
19782
  * arrowhead defs (the surface's hidden defs svg) stand the markers.
19567
19783
  *
19568
- * The SVG itself is pointer-events none; the per-line hit path (the wide
19569
- * transparent stroke) is pointer-events stroke — the line is
19570
- * click-selectable, the empty canvas around it is not.
19784
+ * The SVG is pointer-events none: the visible path is draw-only. The
19785
+ * per-line hit path (the wide transparent stroke, pointer-events stroke)
19786
+ * renders in its own bbox-sized svg — the webkit hit-tests only inside
19787
+ * the svg's own box, so the 1x1 overflow-visible layer is not
19788
+ * click-selectable there; the chromium and the firefox reach the
19789
+ * overflow, so the box change alters no behavior there.
19571
19790
  */
19572
19791
  function ConnectorLine({ id, interactive = true }) {
19573
19792
  const { store } = useEditorContext();
@@ -19588,7 +19807,8 @@ function ConnectorLine({ id, interactive = true }) {
19588
19807
  store
19589
19808
  ]);
19590
19809
  if (content === null) return null;
19591
- return /* @__PURE__ */ jsx("svg", {
19810
+ const hitBox = content.hitD !== null ? hitBoxOf(content.hitD) : null;
19811
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("svg", {
19592
19812
  "data-slot": "docblocks/connector-layer",
19593
19813
  "data-block-id": id,
19594
19814
  style: {
@@ -19600,8 +19820,32 @@ function ConnectorLine({ id, interactive = true }) {
19600
19820
  overflow: "visible",
19601
19821
  pointerEvents: "none"
19602
19822
  },
19603
- children: content
19604
- });
19823
+ children: content.content
19824
+ }), content.hitD !== null && hitBox !== null && /* @__PURE__ */ jsx("svg", {
19825
+ "data-slot": "docblocks/connector-hit-layer",
19826
+ "data-block-id": id,
19827
+ style: {
19828
+ position: "absolute",
19829
+ left: `calc(50% + ${hitBox.x - 16}px)`,
19830
+ top: `calc(50% + ${hitBox.y - 16}px)`,
19831
+ width: hitBox.w + 32,
19832
+ height: hitBox.h + 32,
19833
+ overflow: "visible",
19834
+ pointerEvents: "none"
19835
+ },
19836
+ children: /* @__PURE__ */ jsx("g", {
19837
+ transform: `translate(${16 - hitBox.x}, ${16 - hitBox.y})`,
19838
+ children: /* @__PURE__ */ jsx("path", {
19839
+ "data-connector-hit": id,
19840
+ d: content.hitD,
19841
+ stroke: "transparent",
19842
+ strokeWidth: 12,
19843
+ fill: "none",
19844
+ pointerEvents: "stroke",
19845
+ className: "cursor-pointer"
19846
+ })
19847
+ })
19848
+ })] });
19605
19849
  }
19606
19850
  //#endregion
19607
19851
  //#region src/blocks/PlaceholderBlock.tsx
@@ -28034,7 +28278,7 @@ function crossRangeClipboardContent(doc, selection) {
28034
28278
  function seatCrossSelection(anchor, position) {
28035
28279
  const base = (anchor.node.compareDocumentPosition(position.node) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0 || anchor.offset !== 0 ? anchor : position;
28036
28280
  const focus = base === anchor ? position : anchor;
28037
- window.getSelection()?.setBaseAndExtent(base.node, base.offset, focus.node, focus.offset);
28281
+ applyDomSelection(base.node, base.offset, focus.node, focus.offset);
28038
28282
  }
28039
28283
  /**
28040
28284
  * The text position under (x, y) inside the editor's own scope: the
@@ -28229,6 +28473,43 @@ function useCrossDrag(rootRef, doc) {
28229
28473
  //#endregion
28230
28474
  //#region src/editing/use-editing.ts
28231
28475
  /**
28476
+ * The history reseat's window over the undo/redo (the remount's transient
28477
+ * selection loss's stand): the window's end stands the mapping's none's
28478
+ * suppression. The engine's remount commit + the selectionchange's settle
28479
+ * stands the sub-second over the load, so the window stands a margin over
28480
+ * it (the staleness is bounded by the window's end; the explicit paths —
28481
+ * the Escape, the gutter's reset — stand the real clear).
28482
+ */
28483
+ const RESEAT_WINDOW_MS = 2e3;
28484
+ /**
28485
+ * The undo/redo's reseat over the engine's event ordering: the fast path
28486
+ * re-reads the view over the synchronous read (the restoration's stand
28487
+ * lands inside the undo/redo call), and the window's stand re-runs the
28488
+ * reseat when the restoration's emission lands over the transaction's
28489
+ * settle (the engine's ordering stands the popped's event after the
28490
+ * handler's return — the reseat then reads the restored state). The
28491
+ * reseat's own stands (the user's live selection's stop, the seated's
28492
+ * short-circuit) keep the re-runs from clobbering.
28493
+ */
28494
+ function scheduleHistoryReseat(doc, view, root) {
28495
+ if (view === null) return;
28496
+ const scope = root ?? document;
28497
+ const run = () => {
28498
+ reseatHistorySelection(doc, view, scope);
28499
+ };
28500
+ run();
28501
+ let alive = true;
28502
+ const unsubscribe = view.onChange((selection) => {
28503
+ if (!alive) return;
28504
+ if (selection.kind !== "text") return;
28505
+ run();
28506
+ });
28507
+ window.setTimeout(() => {
28508
+ alive = false;
28509
+ unsubscribe();
28510
+ }, RESEAT_WINDOW_MS);
28511
+ }
28512
+ /**
28232
28513
  * Document-level wiring owned by the editor root: `selectionchange` maps
28233
28514
  * the DOM selection to the core Selection view, the mod+z / mod+shift+z /
28234
28515
  * mod+y hotkeys drive doc.undo()/doc.redo(), and the copy event carries
@@ -28254,6 +28535,7 @@ function useEditing() {
28254
28535
  if (view.get().kind === "blocks" && !domSelectionInEditable(window.getSelection())) return;
28255
28536
  const anchorNode = window.getSelection()?.anchorNode ?? null;
28256
28537
  if ((anchorNode instanceof Element ? anchorNode : anchorNode?.parentElement ?? null)?.closest("[data-slot=\"docblocks/page-card\"]") !== null) return;
28538
+ if (next.kind !== "text" && Date.now() < selectionRef.reseatUntil.current) return;
28257
28539
  if (!selectionsEqual(next, view.get())) view.set(next);
28258
28540
  };
28259
28541
  document.addEventListener("selectionchange", onSelectionChange);
@@ -28308,11 +28590,13 @@ function useEditing() {
28308
28590
  if (key === "z" && !event.shiftKey) {
28309
28591
  event.preventDefault();
28310
28592
  doc.undo();
28311
- if (view !== null) reseatHistorySelection(doc, view, root ?? document);
28593
+ selectionRef.reseatUntil.current = Date.now() + RESEAT_WINDOW_MS;
28594
+ scheduleHistoryReseat(doc, view, root);
28312
28595
  } else if (key === "z" && event.shiftKey || key === "y") {
28313
28596
  event.preventDefault();
28314
28597
  doc.redo();
28315
- if (view !== null) reseatHistorySelection(doc, view, root ?? document);
28598
+ selectionRef.reseatUntil.current = Date.now() + RESEAT_WINDOW_MS;
28599
+ scheduleHistoryReseat(doc, view, root);
28316
28600
  }
28317
28601
  };
28318
28602
  const onCopy = (event) => {
@@ -997,6 +997,16 @@ interface MentionProvider {
997
997
  /** The per-instance selection view; null before the mount effect ran and after unmount. */
998
998
  interface SelectionRef {
999
999
  view: SelectionView | null;
1000
+ /**
1001
+ * The history reseat's window end (the epoch ms): the undo/redo's remount
1002
+ * stands the engine's transient selection loss, and the gesture-time and
1003
+ * event-based mappings' none push stands the remount's residue over the
1004
+ * window (not the user's clear — the real clear stands the explicit
1005
+ * paths: the Escape, the editor's outside's focus).
1006
+ */
1007
+ reseatUntil: {
1008
+ current: number;
1009
+ };
1000
1010
  }
1001
1011
  /**
1002
1012
  * The local user's presence identity and the selection-sharing cipher
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as BlockRendererMap, r as BlockRendererProps, t as BlockRenderer } from "./index-YJcgf8Hh.mjs";
2
- import { $ as ProtocolLimits, A as filterIsComplete, B as DatabaseBridge, C as DatabaseTableView, Ct as BlobSubtype, D as DatabaseTableRow, E as DatabaseTablePhase, F as BridgeTableDescription, G as IsoInstant, H as FilterConditionInput, I as BridgeValueInput, J as OperationStatus, K as MutationContext, L as CellMap, M as BatchOp, N as BridgeColumn, O as UseDatabaseTable, P as BridgeColumnAnnotation, Q as ProtocolDescriptor, R as CellValueParse, S as DatabaseTableProps, St as BlobStore, T as useDatabaseTable, Tt as createMemoryBlobStore, U as FilterInput, V as DomainEvent, W as Id, X as PageSnapshot, Y as PageQuery, Z as ProtocolCapability, _ as PresencePeer, _t as isBridgeError, a as EditorContextValue, at as SortInput, b as useTableList, bt as BlobMeta, c as EmbedSandboxPolicy, ct as SubscriptionStatus, d as PdfPreview, dt as TableEvent, et as QueryOperator, f as PdfPreviewProps, ft as TableRef, g as PresenceIdentity, gt as BridgeErrorCode, h as PresenceCrypto, ht as BridgeError, i as AccessLevel, it as RowWire, j as FilterBuilder, k as emptyFilter, l as MentionEntry, lt as TableDescription, m as SyncEmbedResolver, mt as BRIDGE_ERROR_CODES, n as DEFAULT_EMBED_SANDBOX, nt as Revision, o as EditorMode, ot as SubscriptionHandle, p as PresenceConfig, pt as TableSnapshot, q as MutationReceipt, r as EditorProvider, rt as RowPage, s as EditorProviderProps, st as SubscriptionObserver, t as useEditorContext, tt as QuerySemantics, u as MentionProvider, ut as TableEnvelopeBase, v as PresenceSharing, vt as isBridgeErrorCode, w as UseTableList, wt as blobSubtypeOf, x as DatabaseTable, xt as BlobRef, y as PresenceSharingMode, yt as toBridgeError, z as Column } from "./index-BQRTt8x2.mjs";
2
+ import { $ as ProtocolLimits, A as filterIsComplete, B as DatabaseBridge, C as DatabaseTableView, Ct as BlobSubtype, D as DatabaseTableRow, E as DatabaseTablePhase, F as BridgeTableDescription, G as IsoInstant, H as FilterConditionInput, I as BridgeValueInput, J as OperationStatus, K as MutationContext, L as CellMap, M as BatchOp, N as BridgeColumn, O as UseDatabaseTable, P as BridgeColumnAnnotation, Q as ProtocolDescriptor, R as CellValueParse, S as DatabaseTableProps, St as BlobStore, T as useDatabaseTable, Tt as createMemoryBlobStore, U as FilterInput, V as DomainEvent, W as Id, X as PageSnapshot, Y as PageQuery, Z as ProtocolCapability, _ as PresencePeer, _t as isBridgeError, a as EditorContextValue, at as SortInput, b as useTableList, bt as BlobMeta, c as EmbedSandboxPolicy, ct as SubscriptionStatus, d as PdfPreview, dt as TableEvent, et as QueryOperator, f as PdfPreviewProps, ft as TableRef, g as PresenceIdentity, gt as BridgeErrorCode, h as PresenceCrypto, ht as BridgeError, i as AccessLevel, it as RowWire, j as FilterBuilder, k as emptyFilter, l as MentionEntry, lt as TableDescription, m as SyncEmbedResolver, mt as BRIDGE_ERROR_CODES, n as DEFAULT_EMBED_SANDBOX, nt as Revision, o as EditorMode, ot as SubscriptionHandle, p as PresenceConfig, pt as TableSnapshot, q as MutationReceipt, r as EditorProvider, rt as RowPage, s as EditorProviderProps, st as SubscriptionObserver, t as useEditorContext, tt as QuerySemantics, u as MentionProvider, ut as TableEnvelopeBase, v as PresenceSharing, vt as isBridgeErrorCode, w as UseTableList, wt as blobSubtypeOf, x as DatabaseTable, xt as BlobRef, y as PresenceSharingMode, yt as toBridgeError, z as Column } from "./index-CZEO5s2i.mjs";
3
3
  import * as React from "react";
4
4
  import { ComponentType, ReactNode } from "react";
5
5
  import { Block, BlockId, BlockType, Doc, DocMeta, PresenceState, Selection, SelectionView, SyncEmbedRef, TextRun } from "docblocks-core";
@@ -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-Cn5Dxh5E.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-Cn5Dxh5E.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";
@@ -1,4 +1,4 @@
1
- import { f as PdfPreviewProps } from "../index-BQRTt8x2.mjs";
1
+ import { f as PdfPreviewProps } from "../index-CZEO5s2i.mjs";
2
2
  //#region src/pdf/PdfFirstPage.d.ts
3
3
  declare function PdfFirstPage({ id, url, name }: PdfPreviewProps): import("react").JSX.Element;
4
4
  //#endregion
package/dist/styles.css CHANGED
@@ -2394,17 +2394,6 @@
2394
2394
  .aria-selected\:text-muted-foreground[aria-selected="true"] {
2395
2395
  color: var(--muted-foreground);
2396
2396
  }
2397
- .data-closed\:animate-out[data-closed] {
2398
- animation: exit var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none);
2399
- }
2400
- .data-closed\:fade-out-0[data-closed] {
2401
- --tw-exit-opacity: calc(0/100);
2402
- --tw-exit-opacity: 0;
2403
- }
2404
- .data-closed\:zoom-out-95[data-closed] {
2405
- --tw-exit-scale: calc(95*1%);
2406
- --tw-exit-scale: .95;
2407
- }
2408
2397
  .data-disabled\:pointer-events-none[data-disabled] {
2409
2398
  pointer-events: none;
2410
2399
  }
@@ -2417,17 +2406,6 @@
2417
2406
  .data-inset\:pl-8[data-inset] {
2418
2407
  padding-left: calc(var(--spacing) * 8);
2419
2408
  }
2420
- .data-open\:animate-in[data-open] {
2421
- animation: enter var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none);
2422
- }
2423
- .data-open\:fade-in-0[data-open] {
2424
- --tw-enter-opacity: calc(0/100);
2425
- --tw-enter-opacity: 0;
2426
- }
2427
- .data-open\:zoom-in-95[data-open] {
2428
- --tw-enter-scale: calc(95*1%);
2429
- --tw-enter-scale: .95;
2430
- }
2431
2409
  .data-placeholder\:text-muted-foreground[data-placeholder] {
2432
2410
  color: var(--muted-foreground);
2433
2411
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docblocks-react-ui",
3
- "version": "0.4.4",
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",
@@ -34,7 +34,7 @@
34
34
  "access": "public"
35
35
  },
36
36
  "peerDependencies": {
37
- "docblocks-core": "^0.2.1",
37
+ "docblocks-core": "^0.2.2",
38
38
  "framer-motion": "^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0",
39
39
  "mermaid": "^12.0.0",
40
40
  "pdfjs-dist": "^6.0.0",