docblocks-react-ui 0.30.0 → 0.31.1

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.31.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 0478534: The canvas world snaps to the device pixel grid: the container's centre (the
8
+ world transform's origin) gains a sub-device-pixel compensation, so strokes
9
+ sit on whole pixels instead of antialiasing across two rows at partial alpha.
10
+ An odd container size (an arbitrary consumer height), a fractional device
11
+ ratio, or a fractional pan no longer soften every figure's edge and every
12
+ connector line — the effect that read as a scaled raster at a high zoom.
13
+ - 6eec500: The orthogonal connector clears its own arrowhead before the first bend: the
14
+ stub along the port's normal now runs 18 canvas px (the arrow's 11 px body
15
+ plus 7 px of straight line), so a route that turns right at the figure no
16
+ longer reads as leaving the arrow's side corner — the line comes out of the
17
+ arrow's base centre and only then bends.
18
+
19
+ ## 0.31.0
20
+
21
+ ### Minor Changes
22
+
23
+ - 957bb52: The connectors bend: the line's toolbar adds a waypoint at the route's
24
+ middle segment, the waypoint's dot drags the route's corner (one
25
+ `updateBlock` on the release — the endpoints stay the block refs, the route
26
+ re-derives through the stored points), and the dot's double-click removes
27
+ the point (an empty route drops the attr). The route stands the stored
28
+ `points`, so it persists over the wire, the reload and the undo.
29
+ - 858d145: The canvas containers read as one visual language: the group box stands the
30
+ frame's own ring token and the ring's width, so a container's border is a
31
+ single 2 px muted line (previously a 1 px table line on the group and a
32
+ fainter one on the frame — both lost among brightly stroked figures at a
33
+ low zoom). The title chips carry the same resting border. Rendering only:
34
+ the document data is untouched.
35
+ - ef0baf9: The canvas's floating toolbars stay inside the canvas's visible area: the
36
+ shape, canvas-text and container toolbars flip below the box when the box
37
+ stands too close to the canvas's top edge (the above-the-box stand left the
38
+ canvas and landed under the consumer's header, where no press reached it)
39
+ and clamp inside the canvas's width. The toolbars themselves render
40
+ unpositioned — the canvas view owns their placement.
41
+
42
+ ### Patch Changes
43
+
44
+ - f555207: The canvas marquee no longer takes a container's box for its contents: a
45
+ container or frame is swept by the marquee's border band only (its interior
46
+ stands transparent, the press hit's parity), so a rubber band drawn inside
47
+ a frame takes the figures it crosses; a container whose members stand in
48
+ the marquee yields to them.
49
+ - c07c522: The link popover opens at the selection without moving the document: the
50
+ popover's box stands at the anchor from its first frame (it no longer lays
51
+ out at the editor content's end, where the native focus scroll pulled the
52
+ whole page) and the address input takes the focus without scrolling. A long
53
+ article keeps the reader's position over the open.
54
+ - 4e35a36: The link popover's close restores the text selection: the address input's
55
+ focus collapsed the browser selection, so the Escape (and every other close
56
+ of the popover) left the reader without the highlight and without the copy
57
+ payload. The close now re-seats the DOM selection from the editor's own
58
+ selection, and the focus park takes no scroll.
59
+ - 63474c0: The paste's caret-block tail keeps its run structure: a paste into the
60
+ middle of a line re-inserts the text after the caret with its marks
61
+ (`link`, `bold`, `italic`, …), so the tail no longer degrades to plain
62
+ text. Both paste branches (the plain-text markdown materialization and the
63
+ rich html one) read the tail's runs before the caret block is split and
64
+ re-insert them through the per-run insertion; the single transaction and
65
+ the single undo step stand.
66
+
3
67
  ## 0.30.0
4
68
 
5
69
  ### Minor Changes
@@ -347,6 +347,8 @@ const INIT_OPTIONS = {
347
347
  "straight": "Straight line",
348
348
  "orthogonal": "Orthogonal line",
349
349
  "curved": "Curved line",
350
+ "bend": "Add bend point",
351
+ "bendTitle": "Add a bend point (drag it to bend the line; double-click it to remove)",
350
352
  "lineColor": "Line color",
351
353
  "lineWidth": "Line width",
352
354
  "lineWidthTitle": "Line width (1–4 px)",
@@ -942,6 +944,8 @@ const INIT_OPTIONS = {
942
944
  "straight": "Прямая линия",
943
945
  "orthogonal": "Ортогональная линия",
944
946
  "curved": "Кривая линия",
947
+ "bend": "Добавить точку изгиба",
948
+ "bendTitle": "Добавить точку изгиба (перетащите её, чтобы согнуть линию; двойной клик удаляет)",
945
949
  "lineColor": "Цвет линии",
946
950
  "lineWidth": "Толщина линии",
947
951
  "lineWidthTitle": "Толщина линии (1–4 px)",
@@ -3647,6 +3651,34 @@ function User(props) {
3647
3651
  })]
3648
3652
  });
3649
3653
  }
3654
+ // src/shared/ui/icons/Waypoints.tsx
3655
+ function Waypoints(props) {
3656
+ return /* @__PURE__ */ jsxs("svg", {
3657
+ xmlns: "http://www.w3.org/2000/svg",
3658
+ width: 24,
3659
+ height: 24,
3660
+ viewBox: "0 0 24 24",
3661
+ fill: "none",
3662
+ stroke: "currentColor",
3663
+ strokeWidth: 2,
3664
+ strokeLinecap: "round",
3665
+ strokeLinejoin: "round",
3666
+ ...props,
3667
+ children: [
3668
+ /* @__PURE__ */ jsx("path", { d: "M4 20h4l4-8 4-8h4" }),
3669
+ /* @__PURE__ */ jsx("circle", {
3670
+ cx: "4",
3671
+ cy: "20",
3672
+ r: "2"
3673
+ }),
3674
+ /* @__PURE__ */ jsx("circle", {
3675
+ cx: "20",
3676
+ cy: "4",
3677
+ r: "2"
3678
+ })
3679
+ ]
3680
+ });
3681
+ }
3650
3682
  // src/shared/ui/icons/Zap.tsx
3651
3683
  function Zap(props) {
3652
3684
  return /* @__PURE__ */ jsx("svg", {
@@ -14769,12 +14801,12 @@ function connectorPathPoints(a, b, variant, obstacles) {
14769
14801
  const aAnchored = a.nx !== 0 || a.ny !== 0;
14770
14802
  const bAnchored = b.nx !== 0 || b.ny !== 0;
14771
14803
  const aOut = aAnchored ? {
14772
- x: a.x + a.nx * 12,
14773
- y: a.y + a.ny * 12
14804
+ x: a.x + a.nx * 18,
14805
+ y: a.y + a.ny * 18
14774
14806
  } : a;
14775
14807
  const bIn = bAnchored ? {
14776
- x: b.x + b.nx * 12,
14777
- y: b.y + b.ny * 12
14808
+ x: b.x + b.nx * 18,
14809
+ y: b.y + b.ny * 18
14778
14810
  } : b;
14779
14811
  const horizontal = Math.abs(dx) >= Math.abs(dy);
14780
14812
  const structures = [horizontal ? (t) => [{
@@ -15424,6 +15456,30 @@ function connectorMidpoint(connectorId, childIds, blocks, previews) {
15424
15456
  }
15425
15457
  return connectorPathPoints(startDraw, endDraw, attrs.variant ?? "straight", obstacleBoxes).mid;
15426
15458
  }
15459
+ /**
15460
+ * The connector's STORED waypoints (the bend dots' stand): the attrs'
15461
+ * `points` in the route's own order, the in-flight waypoint drag's point
15462
+ * substituted at its index (the dot follows the handle — the release
15463
+ * commits the same position). The surface-local px (the line's own space).
15464
+ */
15465
+ function connectorWaypointPoints(block, previews) {
15466
+ if (block === void 0 || block.type !== "connector" || block.attrs === void 0) return [];
15467
+ const drag = previews?.endpointDrag ?? null;
15468
+ const preview = previews?.endpointPreview ?? null;
15469
+ if (drag === null || drag.which !== "waypoint" || preview === null || drag.index === void 0) return (block.attrs.points ?? []).map(([x, y]) => ({
15470
+ x,
15471
+ y
15472
+ }));
15473
+ const index = drag.index;
15474
+ const live = preview.point;
15475
+ return (block.attrs.points ?? []).map(([x, y], i) => i === index ? {
15476
+ x: live.x,
15477
+ y: live.y
15478
+ } : {
15479
+ x,
15480
+ y
15481
+ });
15482
+ }
15427
15483
  // src/canvas/geometry/utils/frame-window.ts
15428
15484
  /**
15429
15485
  * The window's offset: the box-local position of the surface's world
@@ -16632,6 +16688,159 @@ function createShapeSessions(store, doc) {
16632
16688
  cancelResize
16633
16689
  };
16634
16690
  }
16691
+ // src/canvas/viewport/session-waypoint.ts
16692
+ /** The round point (the 2-decimal stand — the endpoints' own). */
16693
+ function rounded(point) {
16694
+ return [Number(point.x.toFixed(2)), Number(point.y.toFixed(2))];
16695
+ }
16696
+ /** The connector's session commands (the route's write / the drag / the
16697
+ * midpoint's add / the point's removal). */
16698
+ function createWaypointSessions(store, doc) {
16699
+ const waypointRef = { current: null };
16700
+ /** The connector's stored waypoints (the surface-local px). */
16701
+ const pointsOf = (connectorId) => {
16702
+ const block = doc.getBlock(connectorId);
16703
+ if (block === null || block.type !== "connector") return [];
16704
+ return (block.attrs?.points ?? []).map(([x, y]) => [x, y]);
16705
+ };
16706
+ const writePoints = (connectorId, points) => {
16707
+ const block = doc.getBlock(connectorId);
16708
+ if (block === null || block.type !== "connector") return;
16709
+ try {
16710
+ doc.transact(() => {
16711
+ if (points.length === 0) doc.removeBlockAttr(connectorId, "points");
16712
+ else doc.updateBlock(connectorId, { points });
16713
+ });
16714
+ } catch {}
16715
+ };
16716
+ const beginConnectorWaypoint = (connectorId, index, pointer, startClientX, startClientY) => {
16717
+ const state = store.getState();
16718
+ const block = doc.getBlock(connectorId);
16719
+ if (block === null || block.type !== "connector") return;
16720
+ const stored = pointsOf(connectorId)[index];
16721
+ if (stored === void 0) return;
16722
+ const canvas = screenToCanvas(pointer, state.zoom, state.pan);
16723
+ waypointRef.current = {
16724
+ connectorId,
16725
+ index,
16726
+ startClientX,
16727
+ startClientY,
16728
+ dragging: false,
16729
+ point: canvas
16730
+ };
16731
+ state.setConnectorEndpoint({
16732
+ connectorId,
16733
+ which: "waypoint",
16734
+ index
16735
+ });
16736
+ state.setConnectorEndpointPreview({
16737
+ point: {
16738
+ x: stored[0],
16739
+ y: stored[1]
16740
+ },
16741
+ snap: null
16742
+ });
16743
+ };
16744
+ const moveConnectorWaypoint = (pointer) => {
16745
+ const session = waypointRef.current;
16746
+ if (session === null) return;
16747
+ const state = store.getState();
16748
+ session.dragging = true;
16749
+ const point = screenToCanvas(pointer, state.zoom, state.pan);
16750
+ session.point = point;
16751
+ state.setConnectorEndpointPreview({
16752
+ point,
16753
+ snap: null
16754
+ });
16755
+ };
16756
+ const endConnectorWaypoint = (releaseClientX, releaseClientY) => {
16757
+ const session = waypointRef.current;
16758
+ waypointRef.current = null;
16759
+ const state = store.getState();
16760
+ state.setConnectorEndpoint(null);
16761
+ state.setConnectorEndpointPreview(null);
16762
+ if (session === null || !session.dragging) return;
16763
+ if (releaseClientX !== void 0 && releaseClientY !== void 0 && Math.hypot(releaseClientX - session.startClientX, releaseClientY - session.startClientY) < 3) return;
16764
+ const points = pointsOf(session.connectorId);
16765
+ if (points[session.index] === void 0) return;
16766
+ points[session.index] = rounded(session.point);
16767
+ writePoints(session.connectorId, points);
16768
+ };
16769
+ const cancelConnectorWaypoint = () => {
16770
+ waypointRef.current = null;
16771
+ const state = store.getState();
16772
+ state.setConnectorEndpoint(null);
16773
+ state.setConnectorEndpointPreview(null);
16774
+ };
16775
+ /**
16776
+ * Adds a waypoint at the ROUTE's middle segment's midpoint: the polyline
16777
+ * through the resolved endpoints and the stored waypoints (the geometry's
16778
+ * own route), the longest-middle segment's middle point (the odd count
16779
+ * stands the exact middle, the even count the later's one). The new point
16780
+ * lands between that segment's ends (the route's order).
16781
+ */
16782
+ const addConnectorWaypoint = (connectorId) => {
16783
+ const block = doc.getBlock(connectorId);
16784
+ if (block === null || block.type !== "connector" || block.attrs === void 0) return;
16785
+ const surfaceId = findParentSurface(doc, connectorId);
16786
+ if (surfaceId === null) return;
16787
+ const children = doc.getChildren(surfaceId);
16788
+ const blocks = {};
16789
+ for (const childId of children) {
16790
+ const child = doc.getBlock(childId);
16791
+ if (child !== null) blocks[childId] = child;
16792
+ }
16793
+ const attrs = block.attrs;
16794
+ const start = endpointPointOf(attrs.start, children, blocks, {
16795
+ x: 0,
16796
+ y: 0
16797
+ });
16798
+ const end = start !== null ? endpointPointOf(attrs.end, children, blocks, {
16799
+ x: start.x,
16800
+ y: start.y
16801
+ }) : null;
16802
+ if (start === null || end === null) return;
16803
+ const points = pointsOf(connectorId);
16804
+ const route = [
16805
+ {
16806
+ x: start.x,
16807
+ y: start.y
16808
+ },
16809
+ ...points.map(([x, y]) => ({
16810
+ x,
16811
+ y
16812
+ })),
16813
+ {
16814
+ x: end.x,
16815
+ y: end.y
16816
+ }
16817
+ ];
16818
+ const segment = Math.floor((route.length - 1) / 2);
16819
+ const from = route[segment];
16820
+ const to = route[segment + 1];
16821
+ if (from === void 0 || to === void 0) return;
16822
+ const middle = {
16823
+ x: (from.x + to.x) / 2,
16824
+ y: (from.y + to.y) / 2
16825
+ };
16826
+ points.splice(segment, 0, rounded(middle));
16827
+ writePoints(connectorId, points);
16828
+ };
16829
+ const removeConnectorWaypoint = (connectorId, index) => {
16830
+ const points = pointsOf(connectorId);
16831
+ if (points[index] === void 0) return;
16832
+ points.splice(index, 1);
16833
+ writePoints(connectorId, points);
16834
+ };
16835
+ return {
16836
+ beginConnectorWaypoint,
16837
+ moveConnectorWaypoint,
16838
+ endConnectorWaypoint,
16839
+ cancelConnectorWaypoint,
16840
+ addConnectorWaypoint,
16841
+ removeConnectorWaypoint
16842
+ };
16843
+ }
16635
16844
  // src/canvas/viewport/zoom.ts
16636
16845
  /**
16637
16846
  * The canvas viewport's zoom math: the stop grid's nearest-stop index, the
@@ -16710,6 +16919,7 @@ function createCanvasViewportCommands(store, doc) {
16710
16919
  return {
16711
16920
  ...createShapeSessions(store, doc),
16712
16921
  ...createConnectorSessions(store, doc, standPoint),
16922
+ ...createWaypointSessions(store, doc),
16713
16923
  ...createPlaceCommands(store, doc),
16714
16924
  stepZoom: step,
16715
16925
  zoomAt,
@@ -22905,6 +23115,23 @@ function insertRuns(doc, blockId, from, runs) {
22905
23115
  }
22906
23116
  return pos;
22907
23117
  }
23118
+ /** The runs' slice from `offset` to the content's end (the marks stand). */
23119
+ function sliceRuns(runs, offset) {
23120
+ const sliced = [];
23121
+ let pos = 0;
23122
+ for (const run of runs) {
23123
+ const end = pos + run.text.length;
23124
+ if (end > offset) {
23125
+ const text = run.text.slice(Math.max(0, offset - pos));
23126
+ if (text !== "") sliced.push({
23127
+ text,
23128
+ marks: run.marks
23129
+ });
23130
+ }
23131
+ pos = end;
23132
+ }
23133
+ return sliced;
23134
+ }
22908
23135
  /** The typed insertion (the core's attrs are required per type; the content
22909
23136
  * runs are inserted at the fresh block). */
22910
23137
  function insertNative(doc, m, parent, after, indent) {
@@ -23072,7 +23299,8 @@ function insertTable(doc, m, parent, after, indent) {
23072
23299
  * first pasted block merges into it (the same text type — the block's own
23073
23300
  * type and attrs stand) or follows it, the text after the original caret
23074
23301
  * (the suffix) lands in the last pasted text block (a trailing paragraph
23075
- * when the last block is not text). An empty caret block converts in place
23302
+ * when the last block is not text) with its own run structure — the marks
23303
+ * over the tail stand. An empty caret block converts in place
23076
23304
  * to the first pasted block. Every block the target parent does not accept
23077
23305
  * is demoted (the list/quote → paragraph; the table → one paragraph per
23078
23306
  * row, the cells joined by ` | `) — the paste never throws on legitimate
@@ -23091,6 +23319,7 @@ function materializePaste(doc, seatId, from, to, parsed, opts) {
23091
23319
  const seatText = doc.getText(seatId);
23092
23320
  const prefix = seatText.slice(0, from);
23093
23321
  const suffix = seatText.slice(to);
23322
+ const suffixRuns = sliceRuns(doc.getRuns(seatId), to);
23094
23323
  const seatIndent = indentOf$2(doc, seatId);
23095
23324
  const eligible = (type) => {
23096
23325
  if (parent === null) return true;
@@ -23178,14 +23407,12 @@ function materializePaste(doc, seatId, from, to, parsed, opts) {
23178
23407
  }
23179
23408
  landingOffset = lastTextLen;
23180
23409
  if (suffix !== "") {
23181
- if (lastTextId !== null && lastTextType === "paragraph") {
23182
- doc.insertText(lastTextId, lastTextLen, suffix);
23183
- lastTextLen += suffix.length;
23184
- } else {
23410
+ if (lastTextId !== null && lastTextType === "paragraph") lastTextLen = insertRuns(doc, lastTextId, lastTextLen, suffixRuns);
23411
+ else {
23185
23412
  const indent = clamp(material[material.length - 1].indent, prevIndent);
23186
23413
  prevId = insertBlockWithIndent(doc, "paragraph", parentId, prevId, indent);
23187
23414
  prevIndent = indent;
23188
- doc.insertText(prevId, 0, suffix);
23415
+ insertRuns(doc, prevId, 0, suffixRuns);
23189
23416
  }
23190
23417
  }
23191
23418
  const sequenceNow = doc.getChildren(parentId);
@@ -25500,7 +25727,7 @@ function LinkPopover({ rootRef, state, onClose }) {
25500
25727
  useLayoutEffect(() => {
25501
25728
  const input = inputRef.current;
25502
25729
  if (input === null) return;
25503
- input.focus();
25730
+ input.focus({ preventScroll: true });
25504
25731
  input.select();
25505
25732
  }, []);
25506
25733
  useLayoutEffect(() => {
@@ -25557,7 +25784,11 @@ function LinkPopover({ rootRef, state, onClose }) {
25557
25784
  "data-slot": "docblocks/link-popover",
25558
25785
  "aria-label": t("link.aria"),
25559
25786
  className: cn("absolute z-modal rounded-md border border-border bg-popover p-2 text-popover-foreground shadow-md", position === null && "opacity-0"),
25560
- style: position === null ? { width: POPOVER_WIDTH_PX } : {
25787
+ style: position === null ? {
25788
+ width: POPOVER_WIDTH_PX,
25789
+ left: state.anchor.x,
25790
+ top: state.anchor.y + ANCHOR_OFFSET_PX
25791
+ } : {
25561
25792
  width: POPOVER_WIDTH_PX,
25562
25793
  left: position.left,
25563
25794
  top: position.top
@@ -25723,7 +25954,11 @@ function useLinkPopover(rootRef) {
25723
25954
  if (!parkFocusRef.current) return;
25724
25955
  parkFocusRef.current = false;
25725
25956
  const active = document.activeElement;
25726
- if (active === null || active === document.body) rootRef.current?.focus();
25957
+ if (active === null || active === document.body) {
25958
+ rootRef.current?.focus({ preventScroll: true });
25959
+ const view = selectionRef.view;
25960
+ if (view !== null) reseatHistorySelection(doc, view, rootRef.current ?? document);
25961
+ }
25727
25962
  });
25728
25963
  const open = useCallback((anchor, opts) => {
25729
25964
  setMenu(null);
@@ -27219,8 +27454,13 @@ function connectorLineGeometryOf(connectorId, block, childIds, blocks, session)
27219
27454
  };
27220
27455
  const startPoly = polyPoint(attrs.start, startDraw, startBox, "start");
27221
27456
  const endPoly = polyPoint(attrs.end, endDraw, endBox, "end");
27457
+ const points = (attrs.points ?? []).map(([x, y], index) => {
27458
+ if (!dragging || endpointDrag === null || endpointDrag.which !== "waypoint") return [x, y];
27459
+ if (endpointDrag.index !== index || endpointPreview === null) return [x, y];
27460
+ return [endpointPreview.point.x, endpointPreview.point.y];
27461
+ });
27222
27462
  return {
27223
- path: attrs.points !== void 0 && attrs.points.length > 0 ? `M ${startPoly.x} ${startPoly.y} L ${attrs.points.map(([x, y]) => `${x} ${y}`).join(" L ")} L ${endPoly.x} ${endPoly.y}` : legacy ? connectorPath(startBox, endBox, attrs.variant ?? "straight").d : connectorPathPoints(startDraw, endDraw, attrs.variant ?? "straight", obstacleBoxes).d,
27463
+ path: points.length > 0 ? `M ${startPoly.x} ${startPoly.y} L ${points.map(([x, y]) => `${x} ${y}`).join(" L ")} L ${endPoly.x} ${endPoly.y}` : legacy ? connectorPath(startBox, endBox, attrs.variant ?? "straight").d : connectorPathPoints(startDraw, endDraw, attrs.variant ?? "straight", obstacleBoxes).d,
27224
27464
  startDraw,
27225
27465
  endDraw,
27226
27466
  dragging
@@ -27611,7 +27851,7 @@ function FrameBlock({ id, selected = false, chipMode }) {
27611
27851
  "data-slot": "docblocks/frame-boundary",
27612
27852
  className: "absolute inset-0 rounded-(--docblocks-radius)",
27613
27853
  style: {
27614
- boxShadow: `inset 0 0 0 1px ${selected ? selectedColor : "var(--docblocks-canvas-group-border-color)"}`,
27854
+ boxShadow: `inset 0 0 0 var(--docblocks-canvas-group-border-width) ${selected ? selectedColor : "var(--docblocks-canvas-group-border-color)"}`,
27615
27855
  outline: selected ? `var(--docblocks-canvas-selection-border-width) solid ${selectedColor}` : void 0,
27616
27856
  outlineOffset: 1
27617
27857
  }
@@ -27699,7 +27939,7 @@ function GroupBlock({ id, block, selected, chipMode }) {
27699
27939
  className: "absolute rounded-(--docblocks-radius)",
27700
27940
  style: {
27701
27941
  inset: 0,
27702
- boxShadow: `inset 0 0 0 1px ${selected ? selectedColor : "var(--docblocks-table-border-color)"}`,
27942
+ boxShadow: `inset 0 0 0 var(--docblocks-canvas-group-border-width) ${selected ? selectedColor : "var(--docblocks-canvas-group-border-color)"}`,
27703
27943
  outline: selected ? `1px solid ${selectedColor}` : void 0,
27704
27944
  outlineOffset: 1
27705
27945
  }
@@ -27758,7 +27998,7 @@ function GroupBlock({ id, block, selected, chipMode }) {
27758
27998
  selected,
27759
27999
  slot: "group",
27760
28000
  ariaLabel: t("titleChip.containerTitle"),
27761
- restBorderColor: "var(--docblocks-table-border-color)",
28001
+ restBorderColor: "var(--docblocks-canvas-group-border-color)",
27762
28002
  interactive: chipMode !== "inert"
27763
28003
  })
27764
28004
  ]
@@ -28403,6 +28643,25 @@ function remapEndpoint(ref, copySet, idMap, dx, dy, toward, resolve) {
28403
28643
  }
28404
28644
  return { ...ref };
28405
28645
  }
28646
+ // src/canvas/ConnectorBendButton.tsx
28647
+ /**
28648
+ * The line's bend-point action (the connector toolbar's button): one press
28649
+ * adds a waypoint at the route's middle segment's middle — the waypoint's
28650
+ * dot then drags the route's corner (the dot's double-click removes the
28651
+ * point).
28652
+ */
28653
+ function ConnectorBendButton({ onPress }) {
28654
+ const { t } = useTranslation("canvas");
28655
+ return /* @__PURE__ */ jsx(Button, {
28656
+ variant: "ghost",
28657
+ size: "icon",
28658
+ "data-slot": "docblocks/connector-toolbar-bend",
28659
+ "aria-label": t("connector.bend"),
28660
+ title: t("connector.bendTitle"),
28661
+ onClick: onPress,
28662
+ children: /* @__PURE__ */ jsx(Waypoints, { className: "size-4" })
28663
+ });
28664
+ }
28406
28665
  // src/canvas/ZOrderMenu.tsx
28407
28666
  /**
28408
28667
  * The canvas figure's z-order menu (the explicit zIndex): the
@@ -28718,7 +28977,7 @@ const ARROW_HEADS = [
28718
28977
  icon: /* @__PURE__ */ jsx(Minus, { className: "size-4" })
28719
28978
  }
28720
28979
  ];
28721
- function ConnectorToolbar({ id, variant, strokeColor, strokeWidth, strokeStyle, arrowHead, arrowStart, zStand, style }) {
28980
+ function ConnectorToolbar({ id, variant, strokeColor, strokeWidth, strokeStyle, arrowHead, arrowStart, zStand, style, onAddWaypoint }) {
28722
28981
  const { t } = useTranslation("canvas");
28723
28982
  const { doc } = useEditorContext();
28724
28983
  const [openSection, setOpenSection] = useState(null);
@@ -28816,6 +29075,7 @@ function ConnectorToolbar({ id, variant, strokeColor, strokeWidth, strokeStyle,
28816
29075
  option("straight", "connector.straight", /* @__PURE__ */ jsx(Diagonal, { className: "size-4" })),
28817
29076
  option("orthogonal", "connector.orthogonal", /* @__PURE__ */ jsx(Elbow, { className: "size-4" })),
28818
29077
  option("curved", "connector.curved", /* @__PURE__ */ jsx(Curve, { className: "size-4" })),
29078
+ onAddWaypoint !== void 0 && /* @__PURE__ */ jsx(ConnectorBendButton, { onPress: onAddWaypoint }),
28819
29079
  /* @__PURE__ */ jsx(Separator, {
28820
29080
  orientation: "vertical",
28821
29081
  className: "h-5"
@@ -29306,9 +29566,10 @@ function ShapeTextControls({ slotPrefix, sizeListId, fontFamily, textColor, text
29306
29566
  * position / count over the surface's canvas elements). Each apply is one
29307
29567
  * `updateBlock` in one transact (one undo step, one wire update). The
29308
29568
  * toolbar is canvas chrome (its own pointers; a press on it starts no
29309
- * canvas session).
29569
+ * canvas session). The canvas view places it over the box's top edge
29570
+ * (flipped below the box near the canvas's top edge).
29310
29571
  */
29311
- function CanvasTextToolbar({ id, fontFamily, textColor, textStyle, fontSize, textAlign, zStand, style }) {
29572
+ function CanvasTextToolbar({ id, fontFamily, textColor, textStyle, fontSize, textAlign, zStand, style = {} }) {
29312
29573
  const { t } = useTranslation("canvas");
29313
29574
  const { doc } = useEditorContext();
29314
29575
  const [textColorOpen, setTextColorOpen] = useState(false);
@@ -29328,11 +29589,7 @@ function CanvasTextToolbar({ id, fontFamily, textColor, textStyle, fontSize, tex
29328
29589
  };
29329
29590
  return /* @__PURE__ */ jsx("div", {
29330
29591
  "data-slot": "docblocks/canvas-chrome",
29331
- className: "absolute z-50",
29332
- style: {
29333
- ...style,
29334
- transform: "translate(-50%, -100%)"
29335
- },
29592
+ style,
29336
29593
  onMouseDown: onToolbarBodyMouseDown,
29337
29594
  children: /* @__PURE__ */ jsxs("div", {
29338
29595
  "data-slot": "docblocks/canvas-text-toolbar",
@@ -29378,9 +29635,11 @@ function CanvasTextToolbar({ id, fontFamily, textColor, textStyle, fontSize, tex
29378
29635
  * reorder picks — one `setZOrder` each). Each apply is one `updateBlock`
29379
29636
  * in one transact (one undo step, one wire update). The
29380
29637
  * toolbar is canvas chrome (its own pointers; a press on it starts no
29381
- * canvas session).
29638
+ * canvas session). The canvas view places it over the box's top edge
29639
+ * (flipped below the box near the canvas's top edge — the placement is
29640
+ * the anchor's).
29382
29641
  */
29383
- function ShapeToolbar({ id, fill, stroke, strokeWidth, strokeStyle, variant, text, fontSize, fontFamily, textColor, textStyle, textAlign, zStand, style }) {
29642
+ function ShapeToolbar({ id, fill, stroke, strokeWidth, strokeStyle, variant, text, fontSize, fontFamily, textColor, textStyle, textAlign, zStand, style = {} }) {
29384
29643
  const { t } = useTranslation("canvas");
29385
29644
  const { doc } = useEditorContext();
29386
29645
  const textEdit = useCanvasTextEdit();
@@ -29423,11 +29682,7 @@ function ShapeToolbar({ id, fill, stroke, strokeWidth, strokeStyle, variant, tex
29423
29682
  const beginTextEdit = () => textEdit?.setEditingId(id);
29424
29683
  return /* @__PURE__ */ jsx("div", {
29425
29684
  "data-slot": "docblocks/canvas-chrome",
29426
- className: "absolute z-50",
29427
- style: {
29428
- ...style,
29429
- transform: "translate(-50%, -100%)"
29430
- },
29685
+ style,
29431
29686
  onMouseDown: onToolbarBodyMouseDown,
29432
29687
  children: /* @__PURE__ */ jsxs("div", {
29433
29688
  "data-slot": "docblocks/shape-toolbar",
@@ -29568,18 +29823,15 @@ function ShapeToolbar({ id, fill, stroke, strokeWidth, strokeStyle, variant, tex
29568
29823
  * their own (the group's border / the frame's boundary stand the fixed's
29569
29824
  * stand), so the z-order's menu is the toolbar's whole content. The toolbar
29570
29825
  * is canvas chrome (its own pointers; a press on it starts no canvas
29571
- * session).
29826
+ * session). The canvas view places it over the box's top edge (the
29827
+ * shape toolbar's placement's stand).
29572
29828
  */
29573
- function ZOrderToolbar({ id, kind, zStand, style }) {
29829
+ function ZOrderToolbar({ id, kind, zStand, style = {} }) {
29574
29830
  const { t } = useTranslation("canvas");
29575
29831
  const label = kind === "frame" ? t("arrange.frame") : t("arrange.container");
29576
29832
  return /* @__PURE__ */ jsx("div", {
29577
29833
  "data-slot": "docblocks/canvas-chrome",
29578
- className: "absolute z-50",
29579
- style: {
29580
- ...style,
29581
- transform: "translate(-50%, -100%)"
29582
- },
29834
+ style,
29583
29835
  onMouseDown: onToolbarBodyMouseDown,
29584
29836
  children: /* @__PURE__ */ jsx("div", {
29585
29837
  "data-slot": "docblocks/z-order-toolbar",
@@ -30208,7 +30460,7 @@ function FramePageWindow({ id, frameId, surfaceId, referenced }) {
30208
30460
  style: {
30209
30461
  width: winW,
30210
30462
  height: winH,
30211
- boxShadow: "inset 0 0 0 1px var(--docblocks-canvas-group-border-color)"
30463
+ boxShadow: "inset 0 0 0 var(--docblocks-canvas-group-border-width) var(--docblocks-canvas-group-border-color)"
30212
30464
  },
30213
30465
  children: /* @__PURE__ */ jsx("div", {
30214
30466
  className: "absolute top-0 left-0 origin-top-left",
@@ -33684,6 +33936,28 @@ function StandaloneBody({ id, block }) {
33684
33936
  function childrenSlot(_id, children) {
33685
33937
  if (children === void 0 || children.length === 0) return void 0;
33686
33938
  }
33939
+ // src/shared/hooks/use-device-pixel-ratio.ts
33940
+ /**
33941
+ * The display's device pixel ratio (the canvas world's raster-grid snap's
33942
+ * input): the value changes over a browser zoom, a monitor move, or an OS
33943
+ * scale change — each re-reads it on the window's resize (the ratio itself
33944
+ * never triggers a layout, so the read stands the render's own).
33945
+ */
33946
+ const FALLBACK_RATIO = 1;
33947
+ function readDevicePixelRatio() {
33948
+ if (typeof window === "undefined") return FALLBACK_RATIO;
33949
+ return window.devicePixelRatio > 0 ? window.devicePixelRatio : FALLBACK_RATIO;
33950
+ }
33951
+ function useDevicePixelRatio() {
33952
+ const [ratio, setRatio] = useState(readDevicePixelRatio);
33953
+ useEffect(() => {
33954
+ const read = () => setRatio(readDevicePixelRatio());
33955
+ read();
33956
+ window.addEventListener("resize", read);
33957
+ return () => window.removeEventListener("resize", read);
33958
+ }, []);
33959
+ return ratio;
33960
+ }
33687
33961
  // src/canvas/canvas-view/CanvasTextGhost.tsx
33688
33962
  /**
33689
33963
  * The canvas ghost text block (the double-click's empty-canvas entry): the
@@ -33955,6 +34229,124 @@ function CanvasOverlays({ viewport, previewFrom, previewEnd, previewSnap, hoverS
33955
34229
  })
33956
34230
  ] });
33957
34231
  }
34232
+ // src/canvas/canvas-view/CanvasWaypointHandles.tsx
34233
+ /**
34234
+ * The selected line's waypoint dots (the bend points): the screen-space
34235
+ * stand over the route at any zoom (the line's own options toolbar sits
34236
+ * above them, z-60). The dot's press opens the waypoint's drag (the
34237
+ * container keeps the pointer, the release commits the point); the dot's
34238
+ * double-click stands the point's removal — the drag's pointer capture
34239
+ * retargets the double-click to the canvas container, so the removal
34240
+ * stands in the content's double-click handler (the point's element is
34241
+ * the read there).
34242
+ */
34243
+ function CanvasWaypointHandles({ connectorId, points, screenOf, onPress }) {
34244
+ if (points.length === 0) return null;
34245
+ return /* @__PURE__ */ jsx("div", {
34246
+ "data-slot": "docblocks/connector-waypoints",
34247
+ className: "pointer-events-none absolute inset-0 z-50",
34248
+ children: points.map((point, index) => {
34249
+ const screen = screenOf(point);
34250
+ return /* @__PURE__ */ jsxs("svg", {
34251
+ "data-connector-waypoint": index,
34252
+ "data-connector-waypoint-id": connectorId,
34253
+ width: 16,
34254
+ height: 16,
34255
+ style: {
34256
+ position: "absolute",
34257
+ left: `calc(50% + ${screen.x}px - 8px)`,
34258
+ top: `calc(50% + ${screen.y}px - 8px)`
34259
+ },
34260
+ children: [/* @__PURE__ */ jsx("circle", {
34261
+ cx: 8,
34262
+ cy: 8,
34263
+ r: 8,
34264
+ fill: "transparent",
34265
+ pointerEvents: "all",
34266
+ className: "cursor-grab",
34267
+ onPointerDown: (event) => onPress(connectorId, index, event)
34268
+ }), /* @__PURE__ */ jsx("circle", {
34269
+ cx: 8,
34270
+ cy: 8,
34271
+ r: 4,
34272
+ fill: SURFACE_BG,
34273
+ strokeWidth: 1.5,
34274
+ pointerEvents: "none",
34275
+ className: "stroke-(--docblocks-canvas-selected-stroke)"
34276
+ })]
34277
+ }, `${index}-${point.x}-${point.y}`);
34278
+ })
34279
+ });
34280
+ }
34281
+ // src/canvas/canvas-view/CanvasConnectorChrome.tsx
34282
+ function CanvasConnectorChrome({ viewport, blocks, target, handles, onEndpointPress, onWaypointPress, onAddWaypoint }) {
34283
+ const mid = canvasToScreen(target.mid, viewport.zoom, viewport.pan);
34284
+ const waypointPoints = connectorWaypointPoints(blocks[target.id], {
34285
+ movePreview: viewport.movePreview,
34286
+ resizePreview: viewport.resizePreview,
34287
+ endpointDrag: viewport.connectorEndpoint,
34288
+ endpointPreview: viewport.connectorEndpointPreview
34289
+ });
34290
+ const screenOf = (point) => canvasToScreen(point, viewport.zoom, viewport.pan);
34291
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
34292
+ /* @__PURE__ */ jsx(ConnectorToolbar, {
34293
+ id: target.id,
34294
+ variant: target.variant,
34295
+ strokeColor: target.strokeColor,
34296
+ strokeWidth: target.strokeWidth,
34297
+ strokeStyle: target.strokeStyle,
34298
+ arrowHead: target.arrowHead,
34299
+ arrowStart: target.arrowStart,
34300
+ zStand: target.zStand,
34301
+ onAddWaypoint,
34302
+ style: {
34303
+ left: `calc(50% + ${mid.x}px)`,
34304
+ top: `calc(50% + ${mid.y - 48}px)`
34305
+ }
34306
+ }),
34307
+ handles !== null && /* @__PURE__ */ jsx("div", {
34308
+ "data-slot": "docblocks/connector-handles",
34309
+ className: "pointer-events-none absolute inset-0 z-50",
34310
+ children: ["start", "end"].map((which) => {
34311
+ const point = screenOf(handles[which]);
34312
+ return /* @__PURE__ */ jsxs("svg", {
34313
+ "data-connector-endpoint": which,
34314
+ "data-connector-endpoint-id": target.id,
34315
+ width: 16,
34316
+ height: 16,
34317
+ style: {
34318
+ position: "absolute",
34319
+ left: `calc(50% + ${point.x}px - 8px)`,
34320
+ top: `calc(50% + ${point.y}px - 8px)`
34321
+ },
34322
+ children: [/* @__PURE__ */ jsx("circle", {
34323
+ cx: 8,
34324
+ cy: 8,
34325
+ r: 8,
34326
+ fill: "transparent",
34327
+ pointerEvents: "all",
34328
+ className: "cursor-grab",
34329
+ onPointerDown: (event) => onEndpointPress(which, event)
34330
+ }), /* @__PURE__ */ jsx("circle", {
34331
+ cx: 8,
34332
+ cy: 8,
34333
+ r: 4,
34334
+ fill: "var(--docblocks-canvas-surface-background, var(--card, #ffffff))",
34335
+ strokeWidth: 1.5,
34336
+ pointerEvents: "none",
34337
+ className: "stroke-(--docblocks-canvas-selected-stroke)"
34338
+ })]
34339
+ }, which);
34340
+ })
34341
+ }),
34342
+ /* @__PURE__ */ jsx(CanvasWaypointHandles, {
34343
+ connectorId: target.id,
34344
+ points: waypointPoints,
34345
+ screenOf,
34346
+ onPress: onWaypointPress
34347
+ })
34348
+ ] });
34349
+ }
33958
34350
  // src/canvas/canvas-view/CanvasCycleIndicator.tsx
33959
34351
  /** The drill-down's `i / N` indicator: the small chip at the click point
33960
34352
  * that names the selected candidate's position in the stack and the stack's
@@ -34108,12 +34500,81 @@ function CanvasTitleChips({ surfaces, blocks, visibleIds, selection, viewport, v
34108
34500
  selected,
34109
34501
  slot: block.type,
34110
34502
  ariaLabel: block.type === "group" ? t("titleChip.containerTitle") : t("titleChip.frameTitle"),
34111
- restBorderColor: block.type === "group" ? "var(--docblocks-table-border-color)" : "var(--docblocks-canvas-group-border-color)",
34503
+ restBorderColor: "var(--docblocks-canvas-group-border-color)",
34112
34504
  interactive: !viewMode
34113
34505
  })
34114
34506
  }, `${surfaceId}-${childId}`);
34115
34507
  })) });
34116
34508
  }
34509
+ const ABOVE_TRANSFORM = "translate(-50%, -100%)";
34510
+ const BELOW_TRANSFORM = "translate(-50%, 0)";
34511
+ /**
34512
+ * The toolbar's placement: above the box's top edge when the toolbar's own
34513
+ * height fits between the box and the canvas's top edge, below the box's
34514
+ * bottom edge otherwise (clamped into the canvas's vertical band when the
34515
+ * flipped stand overflows it). The horizontal center clamps into the
34516
+ * canvas's width.
34517
+ */
34518
+ function placeToolbar(centerX, boxTop, boxBottom, container, toolbar) {
34519
+ const measured = toolbar.height > 0;
34520
+ const containerTop = -container.height / 2;
34521
+ const containerBottom = container.height / 2;
34522
+ const fitsAbove = !measured || boxTop - 48 - toolbar.height >= containerTop;
34523
+ let top;
34524
+ let transform;
34525
+ if (fitsAbove) {
34526
+ top = boxTop - 48;
34527
+ transform = ABOVE_TRANSFORM;
34528
+ } else {
34529
+ top = boxBottom + 8;
34530
+ transform = BELOW_TRANSFORM;
34531
+ if (top + toolbar.height > containerBottom) top = containerBottom - toolbar.height;
34532
+ }
34533
+ const halfWidth = toolbar.width / 2;
34534
+ return {
34535
+ left: measured && container.width > toolbar.width ? Math.min(Math.max(centerX, -container.width / 2 + halfWidth), container.width / 2 - halfWidth) : centerX,
34536
+ top,
34537
+ transform
34538
+ };
34539
+ }
34540
+ // src/canvas/canvas-view/CanvasToolbarAnchor.tsx
34541
+ const EMPTY_SIZE = {
34542
+ width: 0,
34543
+ height: 0
34544
+ };
34545
+ function CanvasToolbarAnchor({ centerX, boxTop, boxBottom, container, children }) {
34546
+ const ref = useRef(null);
34547
+ const [size, setSize] = useState(EMPTY_SIZE);
34548
+ useLayoutEffect(() => {
34549
+ const element = ref.current;
34550
+ if (element === null) return;
34551
+ const measure = () => {
34552
+ const next = {
34553
+ width: element.offsetWidth,
34554
+ height: element.offsetHeight
34555
+ };
34556
+ setSize((prev) => prev.width === next.width && prev.height === next.height ? prev : next);
34557
+ };
34558
+ measure();
34559
+ if (typeof ResizeObserver === "undefined") return;
34560
+ const observer = new ResizeObserver(measure);
34561
+ observer.observe(element);
34562
+ return () => observer.disconnect();
34563
+ }, []);
34564
+ const placement = placeToolbar(centerX, boxTop, boxBottom, container, size);
34565
+ const style = {
34566
+ left: `calc(50% + ${placement.left}px)`,
34567
+ top: `calc(50% + ${placement.top}px)`,
34568
+ transform: placement.transform
34569
+ };
34570
+ return /* @__PURE__ */ jsx("div", {
34571
+ ref,
34572
+ "data-slot": "docblocks/canvas-toolbar-anchor",
34573
+ className: "absolute z-50",
34574
+ style,
34575
+ children
34576
+ });
34577
+ }
34117
34578
  // src/canvas/canvas-view/ZoomControls.tsx
34118
34579
  /** The canvas zoom controls (the floating chrome, top-right): the fit / zoom-out /
34119
34580
  * current / zoom-in buttons. The zoom stands in the view state only — no
@@ -34169,12 +34630,36 @@ const ZoomControls = memo(function ZoomControls({ zoom, onStep, onReset, onFit }
34169
34630
  });
34170
34631
  }, (prev, next) => prev.zoom === next.zoom && prev.onStep === next.onStep && prev.onFit === next.onFit);
34171
34632
  // src/canvas/canvas-view/CanvasScreenChrome.tsx
34172
- function CanvasScreenChrome({ viewport, blocks, surfaces, culling, selection, viewMode, targets, onChipPress, onChipDoubleClick, onEndpointPointerDown, onResetZoom, onFit }) {
34633
+ function CanvasScreenChrome({ containerSize, viewport, blocks, surfaces, culling, selection, viewMode, targets, onChipPress, onChipDoubleClick, beginEndpointDrag, beginWaypointDrag, addConnectorWaypoint, onResetZoom, onFit }) {
34173
34634
  const { multiSelectionBox, handleTarget, displayBox, connectorToolbarTarget, selectedConnectorHandles, shapeToolbarTarget, textToolbarTarget, arrangeToolbarTarget } = targets;
34174
- const toolbarTop = (box) => canvasToScreen({
34635
+ const boxTop = (box) => canvasToScreen({
34636
+ x: box.x,
34637
+ y: box.y
34638
+ }, viewport.zoom, viewport.pan).y - box.h / 2 * viewport.zoom;
34639
+ const boxBottom = (box) => canvasToScreen({
34175
34640
  x: box.x,
34176
34641
  y: box.y
34177
- }, viewport.zoom, viewport.pan).y - box.h / 2 * viewport.zoom - 48;
34642
+ }, viewport.zoom, viewport.pan).y + box.h / 2 * viewport.zoom;
34643
+ const connectorId = connectorToolbarTarget?.id ?? null;
34644
+ const onEndpointPress = (which, event) => {
34645
+ if (connectorId === null) return;
34646
+ event.stopPropagation();
34647
+ event.preventDefault();
34648
+ beginEndpointDrag(connectorId, which, event.pointerId, event.clientX, event.clientY);
34649
+ };
34650
+ const onWaypointPress = (id, index, event) => {
34651
+ event.stopPropagation();
34652
+ event.preventDefault();
34653
+ beginWaypointDrag(id, index, event.pointerId, event.clientX, event.clientY);
34654
+ };
34655
+ const onAddWaypoint = () => {
34656
+ if (connectorId === null) return;
34657
+ addConnectorWaypoint(connectorId);
34658
+ };
34659
+ const boxCenterX = (box) => canvasToScreen({
34660
+ x: box.x,
34661
+ y: box.y
34662
+ }, viewport.zoom, viewport.pan).x;
34178
34663
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
34179
34664
  /* @__PURE__ */ jsx(CanvasSelectionOverlay, {
34180
34665
  viewport,
@@ -34204,104 +34689,61 @@ function CanvasScreenChrome({ viewport, blocks, surfaces, culling, selection, vi
34204
34689
  style
34205
34690
  }, handleId))
34206
34691
  }),
34207
- connectorToolbarTarget !== null && /* @__PURE__ */ jsx(ConnectorToolbar, {
34208
- id: connectorToolbarTarget.id,
34209
- variant: connectorToolbarTarget.variant,
34210
- strokeColor: connectorToolbarTarget.strokeColor,
34211
- strokeWidth: connectorToolbarTarget.strokeWidth,
34212
- strokeStyle: connectorToolbarTarget.strokeStyle,
34213
- arrowHead: connectorToolbarTarget.arrowHead,
34214
- arrowStart: connectorToolbarTarget.arrowStart,
34215
- zStand: connectorToolbarTarget.zStand,
34216
- style: {
34217
- left: `calc(50% + ${canvasToScreen(connectorToolbarTarget.mid, viewport.zoom, viewport.pan).x}px)`,
34218
- top: `calc(50% + ${canvasToScreen(connectorToolbarTarget.mid, viewport.zoom, viewport.pan).y - 48}px)`
34219
- }
34692
+ connectorToolbarTarget !== null && /* @__PURE__ */ jsx(CanvasConnectorChrome, {
34693
+ viewport,
34694
+ blocks,
34695
+ target: connectorToolbarTarget,
34696
+ handles: selectedConnectorHandles,
34697
+ onEndpointPress,
34698
+ onWaypointPress,
34699
+ onAddWaypoint
34220
34700
  }),
34221
- selectedConnectorHandles !== null && connectorToolbarTarget !== null && /* @__PURE__ */ jsx("div", {
34222
- "data-slot": "docblocks/connector-handles",
34223
- className: "pointer-events-none absolute inset-0 z-50",
34224
- children: ["start", "end"].map((which) => {
34225
- const point = canvasToScreen(selectedConnectorHandles[which], viewport.zoom, viewport.pan);
34226
- return /* @__PURE__ */ jsxs("svg", {
34227
- "data-connector-endpoint": which,
34228
- "data-connector-endpoint-id": connectorToolbarTarget.id,
34229
- width: 16,
34230
- height: 16,
34231
- style: {
34232
- position: "absolute",
34233
- left: `calc(50% + ${point.x}px - 8px)`,
34234
- top: `calc(50% + ${point.y}px - 8px)`
34235
- },
34236
- children: [/* @__PURE__ */ jsx("circle", {
34237
- cx: 8,
34238
- cy: 8,
34239
- r: 8,
34240
- fill: "transparent",
34241
- pointerEvents: "all",
34242
- className: "cursor-grab",
34243
- onPointerDown: onEndpointPointerDown(which)
34244
- }), /* @__PURE__ */ jsx("circle", {
34245
- cx: 8,
34246
- cy: 8,
34247
- r: 4,
34248
- fill: "var(--docblocks-canvas-surface-background, var(--card, #ffffff))",
34249
- strokeWidth: 1.5,
34250
- pointerEvents: "none",
34251
- className: "stroke-(--docblocks-canvas-selected-stroke)"
34252
- })]
34253
- }, which);
34701
+ shapeToolbarTarget !== null && displayBox !== null && /* @__PURE__ */ jsx(CanvasToolbarAnchor, {
34702
+ centerX: boxCenterX(displayBox),
34703
+ boxTop: boxTop(displayBox),
34704
+ boxBottom: boxBottom(displayBox),
34705
+ container: containerSize,
34706
+ children: /* @__PURE__ */ jsx(ShapeToolbar, {
34707
+ id: shapeToolbarTarget.id,
34708
+ fill: shapeToolbarTarget.fill,
34709
+ stroke: shapeToolbarTarget.stroke,
34710
+ strokeWidth: shapeToolbarTarget.strokeWidth,
34711
+ strokeStyle: shapeToolbarTarget.strokeStyle,
34712
+ variant: shapeToolbarTarget.variant,
34713
+ text: shapeToolbarTarget.text,
34714
+ fontSize: shapeToolbarTarget.fontSize,
34715
+ fontFamily: shapeToolbarTarget.fontFamily,
34716
+ textColor: shapeToolbarTarget.textColor,
34717
+ textStyle: shapeToolbarTarget.textStyle,
34718
+ textAlign: shapeToolbarTarget.textAlign,
34719
+ zStand: shapeToolbarTarget.zStand
34254
34720
  })
34255
34721
  }),
34256
- shapeToolbarTarget !== null && displayBox !== null && /* @__PURE__ */ jsx(ShapeToolbar, {
34257
- id: shapeToolbarTarget.id,
34258
- fill: shapeToolbarTarget.fill,
34259
- stroke: shapeToolbarTarget.stroke,
34260
- strokeWidth: shapeToolbarTarget.strokeWidth,
34261
- strokeStyle: shapeToolbarTarget.strokeStyle,
34262
- variant: shapeToolbarTarget.variant,
34263
- text: shapeToolbarTarget.text,
34264
- fontSize: shapeToolbarTarget.fontSize,
34265
- fontFamily: shapeToolbarTarget.fontFamily,
34266
- textColor: shapeToolbarTarget.textColor,
34267
- textStyle: shapeToolbarTarget.textStyle,
34268
- textAlign: shapeToolbarTarget.textAlign,
34269
- zStand: shapeToolbarTarget.zStand,
34270
- style: {
34271
- left: `calc(50% + ${canvasToScreen({
34272
- x: displayBox.x,
34273
- y: displayBox.y
34274
- }, viewport.zoom, viewport.pan).x}px)`,
34275
- top: `calc(50% + ${toolbarTop(displayBox)}px)`
34276
- }
34277
- }),
34278
- textToolbarTarget !== null && displayBox !== null && /* @__PURE__ */ jsx(CanvasTextToolbar, {
34279
- id: textToolbarTarget.id,
34280
- fontFamily: textToolbarTarget.fontFamily,
34281
- textColor: textToolbarTarget.textColor,
34282
- textStyle: textToolbarTarget.textStyle,
34283
- fontSize: textToolbarTarget.fontSize,
34284
- textAlign: textToolbarTarget.textAlign,
34285
- zStand: textToolbarTarget.zStand,
34286
- style: {
34287
- left: `calc(50% + ${canvasToScreen({
34288
- x: displayBox.x,
34289
- y: displayBox.y
34290
- }, viewport.zoom, viewport.pan).x}px)`,
34291
- top: `calc(50% + ${toolbarTop(displayBox)}px)`
34292
- }
34722
+ textToolbarTarget !== null && displayBox !== null && /* @__PURE__ */ jsx(CanvasToolbarAnchor, {
34723
+ centerX: boxCenterX(displayBox),
34724
+ boxTop: boxTop(displayBox),
34725
+ boxBottom: boxBottom(displayBox),
34726
+ container: containerSize,
34727
+ children: /* @__PURE__ */ jsx(CanvasTextToolbar, {
34728
+ id: textToolbarTarget.id,
34729
+ fontFamily: textToolbarTarget.fontFamily,
34730
+ textColor: textToolbarTarget.textColor,
34731
+ textStyle: textToolbarTarget.textStyle,
34732
+ fontSize: textToolbarTarget.fontSize,
34733
+ textAlign: textToolbarTarget.textAlign,
34734
+ zStand: textToolbarTarget.zStand
34735
+ })
34293
34736
  }),
34294
- arrangeToolbarTarget !== null && displayBox !== null && /* @__PURE__ */ jsx(ZOrderToolbar, {
34295
- id: arrangeToolbarTarget.id,
34296
- kind: arrangeToolbarTarget.kind,
34297
- zStand: arrangeToolbarTarget.zStand,
34298
- style: {
34299
- left: `calc(50% + ${canvasToScreen({
34300
- x: displayBox.x,
34301
- y: displayBox.y
34302
- }, viewport.zoom, viewport.pan).x}px)`,
34303
- top: `calc(50% + ${toolbarTop(displayBox)}px)`
34304
- }
34737
+ arrangeToolbarTarget !== null && displayBox !== null && /* @__PURE__ */ jsx(CanvasToolbarAnchor, {
34738
+ centerX: boxCenterX(displayBox),
34739
+ boxTop: boxTop(displayBox),
34740
+ boxBottom: boxBottom(displayBox),
34741
+ container: containerSize,
34742
+ children: /* @__PURE__ */ jsx(ZOrderToolbar, {
34743
+ id: arrangeToolbarTarget.id,
34744
+ kind: arrangeToolbarTarget.kind,
34745
+ zStand: arrangeToolbarTarget.zStand
34746
+ })
34305
34747
  }),
34306
34748
  /* @__PURE__ */ jsx(ZoomControls, {
34307
34749
  zoom: viewport.zoom,
@@ -34387,6 +34829,20 @@ function ConnectorLabelEdit({ id, mid, stroke, width, lineStyle, label, onClose
34387
34829
  onKeyDown: onLabelKeyDown
34388
34830
  });
34389
34831
  }
34832
+ // src/canvas/canvas-view/world-snap.ts
34833
+ /** The world's translate compensation (screen px, the before-the-scale
34834
+ * translate's own space): zero over an unmeasured container. */
34835
+ function worldSnapOf(pan, container, devicePixelRatio) {
34836
+ const snapAxis = (offset, size) => {
34837
+ if (!(devicePixelRatio > 0) || !(size > 0)) return 0;
34838
+ const origin = size / 2 + offset;
34839
+ return Math.round(origin * devicePixelRatio) / devicePixelRatio - origin;
34840
+ };
34841
+ return {
34842
+ x: snapAxis(pan.x, container.width),
34843
+ y: snapAxis(pan.y, container.height)
34844
+ };
34845
+ }
34390
34846
  // src/canvas/canvas-view/CanvasSurface.tsx
34391
34847
  /** The canvas's surface assembly: the container (the pointer / key
34392
34848
  * sessions' host, the focus's park, the dot grid over the pan / zoom) and
@@ -34395,15 +34851,11 @@ function ConnectorLabelEdit({ id, mid, stroke, width, lineStyle, label, onClose
34395
34851
  * previews) + the screen-space chrome over the world (the marquee, the
34396
34852
  * handles, the toolbars, the dock). The body (CanvasView) stands the
34397
34853
  * session's hooks + the target's reads; this component is the paint. */
34398
- function CanvasSurface({ containerRef, cursor, viewport, handlers, pageContext, pageChildren, pageCardSelected, pageCardDisplayStyle, surfaces, culling, storeSelection, blocks, viewMode, targets, beginEndpointDrag, onResetZoom, onFit }) {
34854
+ function CanvasSurface({ containerRef, containerSize, cursor, viewport, handlers, pageContext, pageChildren, pageCardSelected, pageCardDisplayStyle, surfaces, culling, storeSelection, blocks, viewMode, targets, beginEndpointDrag, beginWaypointDrag, addConnectorWaypoint, onResetZoom, onFit }) {
34399
34855
  const { t } = useTranslation("canvas");
34856
+ const devicePixelRatio = useDevicePixelRatio();
34857
+ const worldSnap = worldSnapOf(viewport.pan, containerSize, devicePixelRatio);
34400
34858
  const { handleTarget, displayBox, multiSelectionBox, shapeToolbarTarget, textToolbarTarget, arrangeToolbarTarget, connectorToolbarTarget, connectorLabelTarget, selectedConnectorHandles, previewFrom, previewSnap, previewEnd, hoverSnapPoint } = targets;
34401
- const onEndpointPointerDown = (which) => (event) => {
34402
- if (connectorToolbarTarget === null) return;
34403
- event.stopPropagation();
34404
- event.preventDefault();
34405
- beginEndpointDrag(connectorToolbarTarget.id, which, event.pointerId, event.clientX, event.clientY);
34406
- };
34407
34859
  return /* @__PURE__ */ jsxs("div", {
34408
34860
  "data-slot": "docblocks/canvas-view",
34409
34861
  ref: containerRef,
@@ -34433,7 +34885,7 @@ function CanvasSurface({ containerRef, cursor, viewport, handlers, pageContext,
34433
34885
  "data-slot": "docblocks/canvas-world",
34434
34886
  className: cn("absolute inset-0", (viewport.moveSession || viewport.resizeSession || viewport.connectorEndpoint !== null) && "select-none"),
34435
34887
  style: {
34436
- transform: `translate(${viewport.pan.x}px, ${viewport.pan.y}px) scale(${viewport.zoom})`,
34888
+ transform: `translate(${viewport.pan.x + worldSnap.x}px, ${viewport.pan.y + worldSnap.y}px) scale(${viewport.zoom})`,
34437
34889
  transformOrigin: "center",
34438
34890
  "--docblocks-canvas-inv-zoom": 1 / viewport.zoom
34439
34891
  },
@@ -34479,6 +34931,7 @@ function CanvasSurface({ containerRef, cursor, viewport, handlers, pageContext,
34479
34931
  })
34480
34932
  ]
34481
34933
  }), /* @__PURE__ */ jsx(CanvasScreenChrome, {
34934
+ containerSize,
34482
34935
  viewport,
34483
34936
  blocks,
34484
34937
  surfaces,
@@ -34497,7 +34950,9 @@ function CanvasSurface({ containerRef, cursor, viewport, handlers, pageContext,
34497
34950
  textToolbarTarget,
34498
34951
  arrangeToolbarTarget
34499
34952
  },
34500
- onEndpointPointerDown,
34953
+ beginEndpointDrag,
34954
+ beginWaypointDrag,
34955
+ addConnectorWaypoint,
34501
34956
  onResetZoom,
34502
34957
  onFit
34503
34958
  })]
@@ -34663,8 +35118,7 @@ function computeCulling(visible, surfaces, blocks, keep) {
34663
35118
  * the surfaces' children's memo holds), the fresh set over the content's
34664
35119
  * change (an item enters / leaves the viewport band).
34665
35120
  */
34666
- function useCanvasCulling(containerRef, viewport, surfaces, blocks) {
34667
- const size = useContainerSize(containerRef);
35121
+ function useCanvasCulling(size, viewport, surfaces, blocks) {
34668
35122
  const measured = size.width > 0 && size.height > 0 ? size : FALLBACK_SIZE;
34669
35123
  const visible = visibleWorldRectOf(viewport.zoom, viewport.pan, measured, 300);
34670
35124
  const cacheRef = useRef(null);
@@ -34831,7 +35285,8 @@ function handleCanvasEscape({ viewport, selection, doc, sessionRef }) {
34831
35285
  return "stop";
34832
35286
  }
34833
35287
  if (viewport.connectorEndpoint !== null) {
34834
- viewport.cancelConnectorEndpoint();
35288
+ if (viewport.connectorEndpoint.which === "waypoint") viewport.cancelConnectorWaypoint();
35289
+ else viewport.cancelConnectorEndpoint();
34835
35290
  return "stop";
34836
35291
  }
34837
35292
  if (viewport.resizePreview !== null) {
@@ -35554,6 +36009,16 @@ function chipDoubleClick(ctx, id, event) {
35554
36009
  function createContentDoubleClick(ctx) {
35555
36010
  return (event) => {
35556
36011
  if (ctx.viewMode) return;
36012
+ const waypointDot = pointElementOf(event) instanceof Element ? pointElementOf(event).closest("[data-connector-waypoint]") : null;
36013
+ if (waypointDot !== null) {
36014
+ const connectorId = waypointDot.getAttribute("data-connector-waypoint-id");
36015
+ const index = Number(waypointDot.getAttribute("data-connector-waypoint"));
36016
+ if (connectorId !== null && Number.isInteger(index)) {
36017
+ event.preventDefault();
36018
+ ctx.viewport.removeConnectorWaypoint(connectorId, index);
36019
+ return;
36020
+ }
36021
+ }
35557
36022
  if (event.altKey) return;
35558
36023
  const touchStep = ctx.viewport.cycleIndicator;
35559
36024
  if (touchStep !== null && ctx.viewport.cycle?.pointerType === "touch") {
@@ -35930,6 +36395,19 @@ function beginEndpointDrag(ctx, connectorId, which, pointerId, clientX, clientY)
35930
36395
  y: clientY - rect.top - rect.height / 2
35931
36396
  }, clientX, clientY);
35932
36397
  }
36398
+ /** The waypoint handle's press (the selected line's bend dot): the endpoint
36399
+ * handle's contract — the container keeps the pointer, the release reads the
36400
+ * session. */
36401
+ function beginWaypointDrag(ctx, connectorId, index, pointerId, clientX, clientY) {
36402
+ const container = ctx.containerRef.current;
36403
+ if (container === null) return;
36404
+ container.setPointerCapture?.(pointerId);
36405
+ const rect = container.getBoundingClientRect();
36406
+ ctx.viewport.beginConnectorWaypoint(connectorId, index, {
36407
+ x: clientX - rect.left - rect.width / 2,
36408
+ y: clientY - rect.top - rect.height / 2
36409
+ }, clientX, clientY);
36410
+ }
35933
36411
  /** The pen's press: the live stroke's begin (the first point is the press's canvas point). */
35934
36412
  function penPress(ctx, event, point) {
35935
36413
  if (ctx.viewport.activeTool !== "pen") return false;
@@ -36021,6 +36499,14 @@ function panPress(ctx, event) {
36021
36499
  return true;
36022
36500
  }
36023
36501
  // src/canvas/canvas-view/canvas-session-release.ts
36502
+ /** Whether the marquee's rect reaches the container's border band: the
36503
+ * box's own rect minus the inset band (the press hit's parity — a
36504
+ * container's interior stands transparent to what lies beneath, so a
36505
+ * marquee drawn in the interior selects the contents, never the box). */
36506
+ function sweepsBorderBand(rect, box) {
36507
+ if (!rectsIntersect(rect, box)) return false;
36508
+ return !(rect.left >= box.left + 6 && rect.left + rect.width <= box.left + box.width - 6 && rect.top >= box.top + 6 && rect.top + rect.height <= box.top + box.height - 6);
36509
+ }
36024
36510
  /** The release handlers (the pointerup's commits + the session's drop + the pointer cancel). The OS / browser takeover (a pointer cancel, a lost capture, a button-less move over a surviving session) drops every in-flight session: the move's preview would otherwise stand until the next release, and that release would commit a stale setGeometry. The no-session calls are no-ops (the state stays, no re-render). */
36025
36511
  function createReleaseHandlers(ctx) {
36026
36512
  const dropCanvasSessions = () => {
@@ -36032,6 +36518,7 @@ function createReleaseHandlers(ctx) {
36032
36518
  ctx.viewport.cancelMove();
36033
36519
  ctx.viewport.cancelResize();
36034
36520
  ctx.viewport.cancelConnectorEndpoint();
36521
+ ctx.viewport.cancelConnectorWaypoint();
36035
36522
  ctx.viewport.setMarquee(null);
36036
36523
  ctx.viewport.setPenPoints([]);
36037
36524
  };
@@ -36039,7 +36526,8 @@ function createReleaseHandlers(ctx) {
36039
36526
  ctx.cardPressRef.current = false;
36040
36527
  if (ctx.viewport.connectorEndpoint !== null) {
36041
36528
  ctx.cycleStepRef.current = null;
36042
- ctx.viewport.endConnectorEndpoint(event.clientX, event.clientY);
36529
+ if (ctx.viewport.connectorEndpoint.which === "waypoint") ctx.viewport.endConnectorWaypoint(event.clientX, event.clientY);
36530
+ else ctx.viewport.endConnectorEndpoint(event.clientX, event.clientY);
36043
36531
  return;
36044
36532
  }
36045
36533
  if (ctx.viewport.activeTool === "connector" && (ctx.viewport.pendingConnector !== null || ctx.viewport.pendingFree !== null)) {
@@ -36114,26 +36602,32 @@ function createReleaseHandlers(ctx) {
36114
36602
  const id = el.getAttribute("data-block-id");
36115
36603
  if (id === null || ctx.blocks[id]?.type === "connector") continue;
36116
36604
  const box = el.getBoundingClientRect();
36117
- if (rectsIntersect(rect, {
36605
+ const itemRect = {
36118
36606
  left: box.left - containerRect.left - center.x,
36119
36607
  top: box.top - containerRect.top - center.y,
36120
36608
  width: box.width,
36121
36609
  height: box.height
36122
- })) ids.push(id);
36610
+ };
36611
+ const type = ctx.blocks[id]?.type;
36612
+ if (type === "group" || type === "frame" ? sweepsBorderBand(rect, itemRect) : rectsIntersect(rect, itemRect)) ids.push(id);
36123
36613
  }
36614
+ const swept = new Set(ids);
36615
+ const picked = ids.filter((id) => {
36616
+ return !(ctx.blocks[id]?.type === "group" ? ctx.blocks[id]?.attrs?.members ?? [] : []).some((member) => member !== id && swept.has(member));
36617
+ });
36124
36618
  if (additive) {
36125
36619
  const sel = ctx.selection.view?.get();
36126
36620
  const base = sel?.kind === "blocks" ? sel.ids : [];
36127
- const merged = [...base, ...ids.filter((id) => !base.includes(id))];
36621
+ const merged = [...base, ...picked.filter((id) => !base.includes(id))];
36128
36622
  ctx.selection.view?.set(merged.length > 0 ? {
36129
36623
  kind: "blocks",
36130
36624
  ids: merged,
36131
36625
  anchorId: base.length > 0 && sel?.kind === "blocks" ? sel.anchorId : merged[0]
36132
36626
  } : { kind: "none" });
36133
- } else ctx.selection.view?.set(ids.length > 0 ? {
36627
+ } else ctx.selection.view?.set(picked.length > 0 ? {
36134
36628
  kind: "blocks",
36135
- ids,
36136
- anchorId: ids[0]
36629
+ ids: picked,
36630
+ anchorId: picked[0]
36137
36631
  } : { kind: "none" });
36138
36632
  ctx.containerRef.current?.focus();
36139
36633
  }
@@ -36191,7 +36685,10 @@ function useCanvasSessions(deps) {
36191
36685
  }
36192
36686
  ctx.viewport.moveDrag(event.clientX, event.clientY);
36193
36687
  ctx.viewport.resizeDrag(event.clientX, event.clientY, event.shiftKey);
36194
- if (ctx.viewport.connectorEndpoint !== null) ctx.viewport.moveConnectorEndpoint(ctx.centerRelativePoint(event));
36688
+ if (ctx.viewport.connectorEndpoint !== null) {
36689
+ if (ctx.viewport.connectorEndpoint.which === "waypoint") ctx.viewport.moveConnectorWaypoint(ctx.centerRelativePoint(event));
36690
+ else ctx.viewport.moveConnectorEndpoint(ctx.centerRelativePoint(event));
36691
+ }
36195
36692
  const session = ctx.sessionRef.current;
36196
36693
  if (session === null) return;
36197
36694
  const point = ctx.centerRelativePoint(event);
@@ -36230,6 +36727,7 @@ function useCanvasSessions(deps) {
36230
36727
  onPointerCancel,
36231
36728
  dropCanvasSessions,
36232
36729
  beginEndpointDrag: (connectorId, which, pointerId, clientX, clientY) => beginEndpointDrag(ctx, connectorId, which, pointerId, clientX, clientY),
36730
+ beginWaypointDrag: (connectorId, index, pointerId, clientX, clientY) => beginWaypointDrag(ctx, connectorId, index, pointerId, clientX, clientY),
36233
36731
  onContentDoubleClick,
36234
36732
  onChipPress: (id, event) => chipPress(ctx, event, id),
36235
36733
  onChipDoubleClick: (id, event) => chipDoubleClick(ctx, id, event)
@@ -36532,10 +37030,11 @@ function CanvasView() {
36532
37030
  viewport,
36533
37031
  rootBlockId
36534
37032
  });
36535
- const culling = useCanvasCulling(containerRef, viewport, surfaces, blocks);
37033
+ const containerSize = useContainerSize(containerRef);
37034
+ const culling = useCanvasCulling(containerSize, viewport, surfaces, blocks);
36536
37035
  if (root === void 0) return null;
36537
37036
  const isEditingSurface = (target) => target instanceof Element && target.closest("[contenteditable=\"true\"], input, textarea") !== null;
36538
- const { onPointerDown, onPointerMove, onPointerUp, onMouseDown, onPointerCancel, dropCanvasSessions, beginEndpointDrag, onContentDoubleClick, onChipPress, onChipDoubleClick } = useCanvasSessions({
37037
+ const { onPointerDown, onPointerMove, onPointerUp, onMouseDown, onPointerCancel, dropCanvasSessions, beginEndpointDrag, beginWaypointDrag, onContentDoubleClick, onChipPress, onChipDoubleClick } = useCanvasSessions({
36539
37038
  containerRef,
36540
37039
  sessionRef,
36541
37040
  lastPointerRef,
@@ -36578,6 +37077,7 @@ function CanvasView() {
36578
37077
  setCanvasTextEditingId: viewport.setCanvasTextEditing,
36579
37078
  children: /* @__PURE__ */ jsx(CanvasSurface, {
36580
37079
  containerRef,
37080
+ containerSize,
36581
37081
  cursor,
36582
37082
  viewport,
36583
37083
  handlers: {
@@ -36618,6 +37118,8 @@ function CanvasView() {
36618
37118
  hoverSnapPoint
36619
37119
  },
36620
37120
  beginEndpointDrag,
37121
+ beginWaypointDrag,
37122
+ addConnectorWaypoint: viewport.addConnectorWaypoint,
36621
37123
  onResetZoom: () => viewport.setZoom(1),
36622
37124
  onFit
36623
37125
  })
package/dist/index.d.mts CHANGED
@@ -404,14 +404,14 @@ declare function Alert({ className, variant, ...props }: React$1.ComponentProps<
404
404
  declare function AlertTitle({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
405
405
  declare function AlertDescription({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
406
406
  declare const badgeVariants: (props?: ({
407
- variant?: "default" | "destructive" | "custom" | "secondary" | "outline" | null | undefined;
407
+ variant?: "custom" | "default" | "secondary" | "destructive" | "outline" | null | undefined;
408
408
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
409
409
  declare function Badge({ className, variant, asChild, ...props }: React$1.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
410
410
  asChild?: boolean;
411
411
  }): React$1.JSX.Element;
412
412
  declare function BareSelect({ className, children, ...props }: React$1.ComponentProps<"select">): React$1.JSX.Element;
413
413
  declare const buttonVariants: (props?: ({
414
- variant?: "default" | "destructive" | "secondary" | "outline" | "ghost" | "link" | null | undefined;
414
+ variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | null | undefined;
415
415
  size?: "default" | "sm" | "lg" | "icon" | "xl" | null | undefined;
416
416
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
417
417
  declare function Button({ className, variant, size, asChild, type, ...props }: React$1.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as DropdownMenuShortcut, $t as useText, A as Select, At as columnAnnotation, B as Label, Bt as CardDescription, C as cellValueEqual, Ct as isBridgeErrorCode, D as filterIsComplete, Dt as conditionMatches, E as emptyFilter, Et as ENUM_OPTION_NAME_COLUMN, F as SelectScrollDownButton, Ft as BookOpen, G as DropdownMenuContent, Gt as badgeVariants, H as Input, Ht as CardHeader, I as SelectScrollUpButton, It as Skeleton, J as DropdownMenuLabel, Jt as useMeta, K as DropdownMenuGroup, Kt as useBlock, L as SelectSeparator, Lt as Card, M as SelectGroup, Mt as Pen, N as SelectItem, Nt as Eye, O as SegmentSelector, Ot as parseCellValue, P as SelectLabel, Q as DropdownMenuSeparator, Qt as useSelectionView, R as SelectTrigger, Rt as CardAction, S as useDatabaseTable, St as isBridgeError, T as FilterBuilder, Tt as ENUM_OPTION_COLOR_COLUMN, U as DropdownMenu, Ut as CardTitle, V as InlineEditInput, Vt as CardFooter, W as DropdownMenuCheckboxItem, Wt as Badge, X as DropdownMenuRadioGroup, Xt as usePresenceSharing, Y as DropdownMenuPortal, Yt as usePresence, Z as DropdownMenuRadioItem, Zt as useSelection, _ as mapFrontmatter, _t as PROTOCOL_VERSION, a as DEFAULT_EMBED_SANDBOX, at as Popover, b as renderRuns, bt as BRIDGE_ERROR_CODES, c as SHAPE_FONT_OPTIONS, ct as PopoverDescription, d as FORMAT_PALETTE, dt as PopoverTrigger, en as DocblocksI18nProvider, et as DropdownMenuSub, ft as Checkbox, g as parseFrontmatter, gt as BASELINE_CAPABILITIES, h as mdToBlocks, ht as AlertTitle, i as useEditorContext, in as buttonVariants, it as Separator, j as SelectContent, k as ScrollArea, kt as TEXT_TYPES, l as SHAPE_FONT_STACKS, lt as PopoverHeader, m as insertNative, mt as AlertDescription, n as useCoverAverageColor, nn as EditorErrorBoundary, nt as DropdownMenuSubTrigger, ot as PopoverAnchor, p as htmlToBlocks, pt as Alert, q as DropdownMenuItem, qt as useDoc, r as EditorProvider, rn as Button, rt as DropdownMenuTrigger, st as PopoverContent, t as Editor, tn as createMemoryBlobStore, tt as DropdownMenuSubContent, ut as PopoverTitle, v as markToggleAction, vt as isDatabaseBridge, w as newMutationContext, wt as toBridgeError, x as GridBody, xt as BridgeError, yt as validateProtocolDescriptor, z as SelectValue, zt as CardContent } from "./Editor-CkiRKR-B.mjs";
1
+ import { $ as DropdownMenuShortcut, $t as useText, A as Select, At as columnAnnotation, B as Label, Bt as CardDescription, C as cellValueEqual, Ct as isBridgeErrorCode, D as filterIsComplete, Dt as conditionMatches, E as emptyFilter, Et as ENUM_OPTION_NAME_COLUMN, F as SelectScrollDownButton, Ft as BookOpen, G as DropdownMenuContent, Gt as badgeVariants, H as Input, Ht as CardHeader, I as SelectScrollUpButton, It as Skeleton, J as DropdownMenuLabel, Jt as useMeta, K as DropdownMenuGroup, Kt as useBlock, L as SelectSeparator, Lt as Card, M as SelectGroup, Mt as Pen, N as SelectItem, Nt as Eye, O as SegmentSelector, Ot as parseCellValue, P as SelectLabel, Q as DropdownMenuSeparator, Qt as useSelectionView, R as SelectTrigger, Rt as CardAction, S as useDatabaseTable, St as isBridgeError, T as FilterBuilder, Tt as ENUM_OPTION_COLOR_COLUMN, U as DropdownMenu, Ut as CardTitle, V as InlineEditInput, Vt as CardFooter, W as DropdownMenuCheckboxItem, Wt as Badge, X as DropdownMenuRadioGroup, Xt as usePresenceSharing, Y as DropdownMenuPortal, Yt as usePresence, Z as DropdownMenuRadioItem, Zt as useSelection, _ as mapFrontmatter, _t as PROTOCOL_VERSION, a as DEFAULT_EMBED_SANDBOX, at as Popover, b as renderRuns, bt as BRIDGE_ERROR_CODES, c as SHAPE_FONT_OPTIONS, ct as PopoverDescription, d as FORMAT_PALETTE, dt as PopoverTrigger, en as DocblocksI18nProvider, et as DropdownMenuSub, ft as Checkbox, g as parseFrontmatter, gt as BASELINE_CAPABILITIES, h as mdToBlocks, ht as AlertTitle, i as useEditorContext, in as buttonVariants, it as Separator, j as SelectContent, k as ScrollArea, kt as TEXT_TYPES, l as SHAPE_FONT_STACKS, lt as PopoverHeader, m as insertNative, mt as AlertDescription, n as useCoverAverageColor, nn as EditorErrorBoundary, nt as DropdownMenuSubTrigger, ot as PopoverAnchor, p as htmlToBlocks, pt as Alert, q as DropdownMenuItem, qt as useDoc, r as EditorProvider, rn as Button, rt as DropdownMenuTrigger, st as PopoverContent, t as Editor, tn as createMemoryBlobStore, tt as DropdownMenuSubContent, ut as PopoverTitle, v as markToggleAction, vt as isDatabaseBridge, w as newMutationContext, wt as toBridgeError, x as GridBody, xt as BridgeError, yt as validateProtocolDescriptor, z as SelectValue, zt as CardContent } from "./Editor-NfJ_5Hyw.mjs";
2
2
  import { useTranslation } from "react-i18next";
3
3
  import { useCallback, useEffect, useRef, useState } from "react";
4
4
  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-CBPODzZc.mjs";
@@ -1,4 +1,4 @@
1
- import { It as Skeleton, Nt as Eye, O as SegmentSelector, Pt as CodeXml, f as textOf, ht as AlertTitle, i as useEditorContext, jt as RotateCcw, mt as AlertDescription, o as childrenSlot, pt as Alert, rn as Button, s as CodeHeader, u as TextBlock, y as INLINE_CODE_CLASS } from "../Editor-CkiRKR-B.mjs";
1
+ import { It as Skeleton, Nt as Eye, O as SegmentSelector, Pt as CodeXml, f as textOf, ht as AlertTitle, i as useEditorContext, jt as RotateCcw, mt as AlertDescription, o as childrenSlot, pt as Alert, rn as Button, s as CodeHeader, u as TextBlock, y as INLINE_CODE_CLASS } from "../Editor-NfJ_5Hyw.mjs";
2
2
  import mermaid from "mermaid";
3
3
  import { useTranslation } from "react-i18next";
4
4
  import { useEffect, useRef, useState } from "react";
package/dist/styles.css CHANGED
@@ -3945,10 +3945,12 @@
3945
3945
  /* The connect indicator (the endpoint drag's port snap: the badge's
3946
3946
  green + the snapped port dot). */
3947
3947
  --docblocks-canvas-connect-color: #16a34a;
3948
- /* The canvas group's resting outline (the flat marker's dashed
3949
- border): the muted line. Declared once, theme-independent (the
3950
- color-mix follows the theme flip). */
3951
- --docblocks-canvas-group-border-color: color-mix(in srgb, var(--muted-foreground, #afb8c1) 55%, transparent);
3948
+ /* The canvas container's resting outline (the group / the frame box):
3949
+ the muted line, strong enough to read over brightly stroked figures
3950
+ at a low zoom. Declared once, theme-independent (the color-mix
3951
+ follows the theme flip); the width stands the box's ring. */
3952
+ --docblocks-canvas-group-border-color: color-mix(in srgb, var(--muted-foreground, #afb8c1) 85%, transparent);
3953
+ --docblocks-canvas-group-border-width: 2px;
3952
3954
 
3953
3955
  /* The floating format toolbar (the selection's formatting layer). */
3954
3956
  --docblocks-formatbar-background: var(--popover, #ffffff);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docblocks-react-ui",
3
- "version": "0.30.0",
3
+ "version": "0.31.1",
4
4
  "description": "React rendering + editing layer for docblocks: hooks, block renderers, caret/selection, keyboard, clipboard.",
5
5
  "type": "module",
6
6
  "license": "MIT",