@cardenelabs/cdl 0.21.0 → 0.21.2

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/dist/index.js CHANGED
@@ -12024,6 +12024,18 @@ function \u4E2D\u8EAB\u304B\u3089\u51FA\u3059\u9AD8\u3055(kind, \u6E80\u8F09h, \
12024
12024
  return Math.max(MIN_BOX_H, \u6E80\u8F09h - \u5F15\u304F);
12025
12025
  }
12026
12026
  var MIN_BOX_H = 44;
12027
+ var CLOUD_CIRCLES = [
12028
+ { cx: -0.8, cy: -0.05 + 0.08, r: 0.32 },
12029
+ { cx: -0.4, cy: -0.05 - 0.05, r: 0.4 },
12030
+ { cx: 0, cy: -0.05 - 0.1, r: 0.46 },
12031
+ { cx: 0.4, cy: -0.05 - 0.05, r: 0.4 },
12032
+ { cx: 0.8, cy: -0.05 + 0.08, r: 0.32 }
12033
+ ];
12034
+ var CLOUD_ART_CENTER_RISE = (() => {
12035
+ const \u4E0A = Math.min(...CLOUD_CIRCLES.map((c) => c.cy - c.r));
12036
+ const \u4E0B = Math.max(...CLOUD_CIRCLES.map((c) => c.cy + c.r));
12037
+ return -(\u4E0A + \u4E0B) / 2;
12038
+ })();
12027
12039
 
12028
12040
  // src/layout/footer-shape.ts
12029
12041
  var SHAPE_DRAW_UP_EXTENT = {
@@ -13090,8 +13102,12 @@ function resolveEdgeLabelOverlapsWithChainAndPropagate(edges, obstacles, minClea
13090
13102
  for (const { p } of ordered) {
13091
13103
  const axis = p.axis;
13092
13104
  if (!pathShiftIsSafe(e.id, axis, p.sign, amount)) continue;
13105
+ const \u52D5\u304B\u3057\u305F\u5F8C = measurePathLabelGapSegs(
13106
+ simulateShiftedSegments(e, axis === "x" ? p.sign * amount : 0, axis === "y" ? p.sign * amount : 0),
13107
+ label
13108
+ );
13093
13109
  out.push({ target: { kind: "edge-path", id: e.id }, axis, sign: p.sign, amount });
13094
- \u7DDA\u3092\u52D5\u304B\u305B\u305F = true;
13110
+ \u7DDA\u3092\u52D5\u304B\u305B\u305F = \u52D5\u304B\u3057\u305F\u5F8C > gap;
13095
13111
  break;
13096
13112
  }
13097
13113
  if (!\u7DDA\u3092\u52D5\u304B\u305B\u305F) {
@@ -13114,16 +13130,49 @@ function resolveEdgeLabelOverlapsWithChainAndPropagate(edges, obstacles, minClea
13114
13130
  if (\u8FD1\u3044\u70B9) {
13115
13131
  const dx = \u82AF.x - \u8FD1\u3044\u70B9.x;
13116
13132
  const dy = \u82AF.y - \u8FD1\u3044\u70B9.y;
13117
- const axis = Math.abs(dx) >= Math.abs(dy) ? "x" : "y";
13118
- const \u5411\u304D = axis === "x" ? dx : dy;
13119
- const sign = \u5411\u304D >= 0 ? 1 : -1;
13120
- out.push({
13121
- target: { kind: "label", id: label.id },
13122
- axis,
13123
- sign,
13124
- amount: pathLabelClearance - gap + NEAR_MISS_MARGIN,
13125
- chain: false
13133
+ const \u91CF = pathLabelClearance - gap + NEAR_MISS_MARGIN;
13134
+ const \u5019\u88DC = Math.abs(dx) >= Math.abs(dy) ? [
13135
+ { axis: "x", sign: dx >= 0 ? 1 : -1 },
13136
+ { axis: "y", sign: dy >= 0 ? 1 : -1 }
13137
+ ] : [
13138
+ { axis: "y", sign: dy >= 0 ? 1 : -1 },
13139
+ { axis: "x", sign: dx >= 0 ? 1 : -1 }
13140
+ ];
13141
+ const \u52D5\u304B\u3057\u305F\u7BB1 = (axis, sign) => ({
13142
+ ...label,
13143
+ x: label.x + (axis === "x" ? sign * \u91CF : 0),
13144
+ y: label.y + (axis === "y" ? sign * \u91CF : 0)
13126
13145
  });
13146
+ const \u7DDA\u3054\u3068\u306E\u8DDD\u96E2 = (\u7BB1) => {
13147
+ const \u51FA = /* @__PURE__ */ new Map();
13148
+ for (const \u4ED6 of edges) {
13149
+ if (\u4ED6.id === label.id) continue;
13150
+ const segs2 = segmentsExcludingOwnPath(shiftedSegments(\u4ED6.id, \u4ED6.d), ownSegsOf(label.id));
13151
+ if (segs2.length === 0) continue;
13152
+ \u51FA.set(\u4ED6.id, measurePathLabelGapSegs(segs2, \u7BB1));
13153
+ }
13154
+ return \u51FA;
13155
+ };
13156
+ const \u3044\u307E\u306E\u8DDD\u96E2 = \u7DDA\u3054\u3068\u306E\u8DDD\u96E2(label);
13157
+ const \u60AA\u304F\u3059\u308B = (\u7BB1) => {
13158
+ const \u5F8C = \u7DDA\u3054\u3068\u306E\u8DDD\u96E2(\u7BB1);
13159
+ for (const [id, \u524D\u306E\u5024] of \u3044\u307E\u306E\u8DDD\u96E2) {
13160
+ const \u5F8C\u306E\u5024 = \u5F8C.get(id) ?? Infinity;
13161
+ if (\u5F8C\u306E\u5024 < Math.min(\u524D\u306E\u5024, pathLabelClearance)) return true;
13162
+ }
13163
+ return false;
13164
+ };
13165
+ for (const \u5019 of \u5019\u88DC) {
13166
+ if (\u60AA\u304F\u3059\u308B(\u52D5\u304B\u3057\u305F\u7BB1(\u5019.axis, \u5019.sign))) continue;
13167
+ out.push({
13168
+ target: { kind: "label", id: label.id },
13169
+ axis: \u5019.axis,
13170
+ sign: \u5019.sign,
13171
+ amount: \u91CF,
13172
+ chain: false
13173
+ });
13174
+ break;
13175
+ }
13127
13176
  }
13128
13177
  }
13129
13178
  }
@@ -22465,21 +22514,12 @@ function GenericNode({
22465
22514
  if (shape === "cloud") {
22466
22515
  const cx = w / 2;
22467
22516
  const cy = h / 2;
22468
- const cloudCenterY = cy - h * 0.05;
22469
- const usableW = w * 0.85;
22470
- const halfW = usableW / 2;
22471
- const circles = [
22472
- { cx: cx - halfW * 0.8, cy: cloudCenterY + h * 0.08, r: h * 0.32 },
22473
- // 左端
22474
- { cx: cx - halfW * 0.4, cy: cloudCenterY - h * 0.05, r: h * 0.4 },
22475
- // 左
22476
- { cx, cy: cloudCenterY - h * 0.1, r: h * 0.46 },
22477
- // 中央 (最大)
22478
- { cx: cx + halfW * 0.4, cy: cloudCenterY - h * 0.05, r: h * 0.4 },
22479
- // 右
22480
- { cx: cx + halfW * 0.8, cy: cloudCenterY + h * 0.08, r: h * 0.32 }
22481
- // 右端
22482
- ];
22517
+ const halfW = w * 0.85 / 2;
22518
+ const circles = CLOUD_CIRCLES.map((c) => ({
22519
+ cx: cx + halfW * c.cx,
22520
+ cy: cy + h * c.cy,
22521
+ r: h * c.r
22522
+ }));
22483
22523
  return /* @__PURE__ */ jsxs("g", { children: [
22484
22524
  circles.map((c, i) => /* @__PURE__ */ jsx("circle", { cx: c.cx, cy: c.cy, r: c.r, fill: "var(--cdl-node-fill, #ffffff)" }, `fill-${i}`)),
22485
22525
  circles.map((c, i) => /* @__PURE__ */ jsx(
@@ -22518,11 +22558,12 @@ function GenericNode({
22518
22558
  const textX = centered ? w / 2 : 20;
22519
22559
  const cylinderShift = genericTextShift(node.kind);
22520
22560
  const \u7E70\u308A\u4E0A\u3052 = node.eyebrow || centered ? 0 : \u76EE\u5370\u306A\u3057\u306E\u7E70\u308A\u4E0A\u3052(node.kind, hasRows);
22521
- const eyebrowY = centered ? h / 2 - 26 : 32 + cylinderShift;
22522
- const titleY = genericTitleBaselineY(node.kind, h, hasRows) - \u7E70\u308A\u4E0A\u3052;
22523
- const subtitleY = centered ? h / 2 + 28 : 96 + cylinderShift - \u7E70\u308A\u4E0A\u3052;
22561
+ const \u7D75\u306E\u82AF = centered && STYLES[node.kind]?.shape === "cloud" ? h * CLOUD_ART_CENTER_RISE : 0;
22562
+ const eyebrowY = centered ? h / 2 - 26 - \u7D75\u306E\u82AF : 32 + cylinderShift;
22563
+ const titleY = genericTitleBaselineY(node.kind, h, hasRows) - \u7E70\u308A\u4E0A\u3052 - \u7D75\u306E\u82AF;
22564
+ const subtitleY = centered ? h / 2 + 28 - \u7D75\u306E\u82AF : 96 + cylinderShift - \u7E70\u308A\u4E0A\u3052;
22524
22565
  const iconX = centered ? w / 2 + 40 : w - 48;
22525
- const iconY = centered ? h / 2 - 44 : 18 + cylinderShift;
22566
+ const iconY = centered ? h / 2 - 44 - \u7D75\u306E\u82AF : 18 + cylinderShift;
22526
22567
  const dominantBaseline = centered ? "middle" : void 0;
22527
22568
  return /* @__PURE__ */ jsxs("g", { transform: `translate(${x} ${y})`, "data-cdl-role": "node-body", children: [
22528
22569
  shapeEl,