@markasso/mcp 0.6.0 → 0.6.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.
@@ -4203,7 +4203,7 @@ function escapeXml(str) {
4203
4203
  }
4204
4204
  //#endregion
4205
4205
  //#region package.json
4206
- var version = "0.6.0";
4206
+ var version = "0.6.1";
4207
4207
  //#endregion
4208
4208
  //#region ../src/core/layout.ts
4209
4209
  /** Orders vertices without recursion, preserving input order when unconstrained. */
@@ -5669,6 +5669,8 @@ var DEFAULT_SIZES = {
5669
5669
  };
5670
5670
  /** Gap used when placing new nodes before an explicit layout. */
5671
5671
  var PLACEMENT_GAP = 60;
5672
+ /** Space below each unconnected text node (title) stacked above a layout. */
5673
+ var FLOATING_TEXT_GAP = 40;
5672
5674
  var BASE_STYLE = {
5673
5675
  strokeWidth: 2,
5674
5676
  opacity: 1,
@@ -6151,7 +6153,12 @@ var Diagram = class {
6151
6153
  x: Math.min(...[...boxes.values()].map((b) => b.x)),
6152
6154
  y: Math.min(...[...boxes.values()].map((b) => b.y))
6153
6155
  };
6154
- const positions = layeredLayout(nodes.map((el) => {
6156
+ const linked = new Set(this.elements.flatMap((el) => isConnector$1(el) ? [el.startElementId, el.endElementId].filter((id) => id !== void 0) : []));
6157
+ const floating = nodes.filter((el) => el.type === "text" && !linked.has(el.id));
6158
+ const laid = floating.length > 0 && floating.length < nodes.length ? nodes.filter((el) => !floating.includes(el)) : nodes;
6159
+ const above = laid === nodes ? [] : floating;
6160
+ const stackHeight = above.reduce((sum, el) => sum + boxes.get(el.id).h + FLOATING_TEXT_GAP, 0);
6161
+ const positions = layeredLayout(laid.map((el) => {
6155
6162
  const b = boxes.get(el.id);
6156
6163
  return {
6157
6164
  id: el.id,
@@ -6160,8 +6167,23 @@ var Diagram = class {
6160
6167
  };
6161
6168
  }), edges, {
6162
6169
  direction,
6163
- origin
6170
+ origin: {
6171
+ x: origin.x,
6172
+ y: origin.y + stackHeight
6173
+ }
6164
6174
  });
6175
+ if (above.length > 0) {
6176
+ const center = (Math.min(...laid.map((el) => positions.get(el.id).x)) + Math.max(...laid.map((el) => positions.get(el.id).x + boxes.get(el.id).w))) / 2;
6177
+ let y = origin.y;
6178
+ for (const el of above) {
6179
+ const b = boxes.get(el.id);
6180
+ positions.set(el.id, {
6181
+ x: center - b.w / 2,
6182
+ y
6183
+ });
6184
+ y += b.h + FLOATING_TEXT_GAP;
6185
+ }
6186
+ }
6165
6187
  this.moveNodes(positions);
6166
6188
  return positions.size;
6167
6189
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markasso/mcp",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "MCP server that lets AI agents create, read and edit Markasso diagrams, offline or live on a shared board",
5
5
  "type": "module",
6
6
  "repository": {