@cardenelabs/cdl 0.21.1 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.js CHANGED
@@ -846,6 +846,25 @@ function \u4E2D\u8EAB\u304B\u3089\u51FA\u3059\u9AD8\u3055(kind, \u6E80\u8F09h, \
846
846
  return Math.max(MIN_BOX_H, \u6E80\u8F09h - \u5F15\u304F);
847
847
  }
848
848
  var MIN_BOX_H = 44;
849
+ var CLOUD_CIRCLES = [
850
+ { cx: -0.8, cy: -0.05 + 0.08, r: 0.32 },
851
+ { cx: -0.4, cy: -0.05 - 0.05, r: 0.4 },
852
+ { cx: 0, cy: -0.05 - 0.1, r: 0.46 },
853
+ { cx: 0.4, cy: -0.05 - 0.05, r: 0.4 },
854
+ { cx: 0.8, cy: -0.05 + 0.08, r: 0.32 }
855
+ ];
856
+ var CLOUD_ART_CENTER_RISE = (() => {
857
+ const \u4E0A = Math.min(...CLOUD_CIRCLES.map((c) => c.cy - c.r));
858
+ const \u4E0B = Math.max(...CLOUD_CIRCLES.map((c) => c.cy + c.r));
859
+ return -(\u4E0A + \u4E0B) / 2;
860
+ })();
861
+ function \u4F59\u308A\u3092\u5206\u3051\u308B(kind, \u6E80\u8F09h, \u5B9F\u969B\u306Eh, \u4E2D\u8EAB) {
862
+ if (!\u6BB5\u3092\u7A4D\u3080\u7BB1\u304B(kind, \u4E2D\u8EAB.hasRows)) return 0;
863
+ if (\u4E2D\u8EAB.hasValue) return 0;
864
+ const \u8981\u308B\u9AD8\u3055 = \u4E2D\u8EAB\u304B\u3089\u51FA\u3059\u9AD8\u3055(kind, \u6E80\u8F09h, \u4E2D\u8EAB);
865
+ const \u4F59\u308A = \u5B9F\u969B\u306Eh - \u8981\u308B\u9AD8\u3055;
866
+ return \u4F59\u308A > 0 ? Math.round(\u4F59\u308A / 2) : 0;
867
+ }
849
868
 
850
869
  // src/layout/footer-shape.ts
851
870
  var SHAPE_DRAW_UP_EXTENT = {
@@ -6057,7 +6076,14 @@ function ActorNode({ node, active, value }) {
6057
6076
  const x = node.cx - node.w / 2;
6058
6077
  const y = node.cy - node.h / 2;
6059
6078
  const \u7E70\u308A\u4E0A\u3052 = node.eyebrow ? 0 : \u76EE\u5370\u306A\u3057\u306E\u7E70\u308A\u4E0A\u3052("actor");
6060
- const \u540D\u524D = titlePlacement(node, { x: 26, y: 86 - \u7E70\u308A\u4E0A\u3052, size: 32 }, { hasEyebrow: Boolean(node.eyebrow) });
6079
+ const \u4F59\u308A = \u4F59\u308A\u3092\u5206\u3051\u308B("actor", NODE_SIZE.actor.h, node.h, {
6080
+ hasEyebrow: Boolean(node.eyebrow),
6081
+ hasSubtitle: Boolean(node.subtitle),
6082
+ hasValue: Boolean(value),
6083
+ hasRows: false
6084
+ });
6085
+ const \u305A\u3089\u3057 = \u7E70\u308A\u4E0A\u3052 - \u4F59\u308A;
6086
+ const \u540D\u524D = titlePlacement(node, { x: 26, y: 86 - \u305A\u3089\u3057, size: 32 }, { hasEyebrow: Boolean(node.eyebrow) });
6061
6087
  return /* @__PURE__ */ jsxs("g", { transform: `translate(${x} ${y})`, children: [
6062
6088
  /* @__PURE__ */ jsx(
6063
6089
  "rect",
@@ -6073,7 +6099,7 @@ function ActorNode({ node, active, value }) {
6073
6099
  strokeWidth: active ? 3 : 1.25
6074
6100
  }
6075
6101
  ),
6076
- node.eyebrow && /* @__PURE__ */ jsx("text", { x: 26, y: 38, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
6102
+ node.eyebrow && /* @__PURE__ */ jsx("text", { x: 26, y: 38 - \u4F59\u308A, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
6077
6103
  /* @__PURE__ */ jsx(
6078
6104
  "text",
6079
6105
  {
@@ -6092,13 +6118,13 @@ function ActorNode({ node, active, value }) {
6092
6118
  {
6093
6119
  "data-cdl-role": "node-row-divider",
6094
6120
  x1: 26,
6095
- y1: 110 - \u7E70\u308A\u4E0A\u3052,
6121
+ y1: 110 - \u305A\u3089\u3057,
6096
6122
  x2: node.w - 26,
6097
- y2: 110 - \u7E70\u308A\u4E0A\u3052,
6123
+ y2: 110 - \u305A\u3089\u3057,
6098
6124
  stroke: "var(--cdl-row-divider, #7e848e)"
6099
6125
  }
6100
6126
  ),
6101
- node.subtitle && /* @__PURE__ */ jsx("text", { x: 26, y: 140 - \u7E70\u308A\u4E0A\u3052, fontSize: 20, fill: "var(--cdl-text-dim, #5a6270)", children: node.subtitle }),
6127
+ node.subtitle && /* @__PURE__ */ jsx("text", { x: 26, y: 140 - \u305A\u3089\u3057, fontSize: 20, fill: "var(--cdl-text-dim, #5a6270)", children: node.subtitle }),
6102
6128
  value && /* @__PURE__ */ jsx(
6103
6129
  "text",
6104
6130
  {
@@ -6124,7 +6150,14 @@ function CardNode({ node, active }) {
6124
6150
  const compact = isCompactBox(node.h);
6125
6151
  const \u5C0F\u578B\u306B\u547C\u3073\u540D = compact && Boolean(node.subtitle);
6126
6152
  const \u7E70\u308A\u4E0A\u3052 = node.eyebrow ? 0 : \u76EE\u5370\u306A\u3057\u306E\u7E70\u308A\u4E0A\u3052("card");
6127
- const titleY = compact ? \u5C0F\u578B\u306B\u547C\u3073\u540D ? node.h / 2 - 2 : node.h / 2 + 8 : 86 - \u7E70\u308A\u4E0A\u3052;
6153
+ const \u4F59\u308A = compact ? 0 : \u4F59\u308A\u3092\u5206\u3051\u308B("card", NODE_SIZE.card.h, node.h, {
6154
+ hasEyebrow: Boolean(node.eyebrow),
6155
+ hasSubtitle: Boolean(node.subtitle),
6156
+ hasValue: false,
6157
+ hasRows: false
6158
+ });
6159
+ const \u305A\u3089\u3057 = \u7E70\u308A\u4E0A\u3052 - \u4F59\u308A;
6160
+ const titleY = compact ? \u5C0F\u578B\u306B\u547C\u3073\u540D ? node.h / 2 - 2 : node.h / 2 + 8 : 86 - \u305A\u3089\u3057;
6128
6161
  const titleX = compact ? node.w / 2 : 26;
6129
6162
  const paddingX = compact ? 16 : 52;
6130
6163
  const availableW = node.w - paddingX;
@@ -6147,7 +6180,7 @@ function CardNode({ node, active }) {
6147
6180
  strokeWidth: active ? 3 : 1.25
6148
6181
  }
6149
6182
  ),
6150
- !compact && node.eyebrow && /* @__PURE__ */ jsx("text", { x: 26, y: 38, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
6183
+ !compact && node.eyebrow && /* @__PURE__ */ jsx("text", { x: 26, y: 38 - \u4F59\u308A, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
6151
6184
  /* @__PURE__ */ jsx(
6152
6185
  "text",
6153
6186
  {
@@ -6161,7 +6194,7 @@ function CardNode({ node, active }) {
6161
6194
  children: node.title
6162
6195
  }
6163
6196
  ),
6164
- !compact && node.subtitle && /* @__PURE__ */ jsx("text", { x: 26, y: 124 - \u7E70\u308A\u4E0A\u3052, fontSize: subtitleSize, fill: "var(--cdl-text-dim, #5a6270)", children: node.subtitle }),
6197
+ !compact && node.subtitle && /* @__PURE__ */ jsx("text", { x: 26, y: 124 - \u305A\u3089\u3057, fontSize: subtitleSize, fill: "var(--cdl-text-dim, #5a6270)", children: node.subtitle }),
6165
6198
  \u5C0F\u578B\u306B\u547C\u3073\u540D && /* @__PURE__ */ jsx(
6166
6199
  "text",
6167
6200
  {
@@ -6423,7 +6456,14 @@ function EventNode({
6423
6456
  const x = node.cx - node.w / 2;
6424
6457
  const y = node.cy - node.h / 2;
6425
6458
  const \u7E70\u308A\u4E0A\u3052 = node.eyebrow ? 0 : \u76EE\u5370\u306A\u3057\u306E\u7E70\u308A\u4E0A\u3052("event");
6426
- const \u540D\u524D = titlePlacement(node, { x: 26, y: 88 - \u7E70\u308A\u4E0A\u3052, size: 26 }, { hasEyebrow: Boolean(node.eyebrow) });
6459
+ const \u4F59\u308A = \u4F59\u308A\u3092\u5206\u3051\u308B("event", NODE_SIZE.event.h, node.h, {
6460
+ hasEyebrow: Boolean(node.eyebrow),
6461
+ hasSubtitle: Boolean(node.subtitle),
6462
+ hasValue: false,
6463
+ hasRows: false
6464
+ });
6465
+ const \u305A\u3089\u3057 = \u7E70\u308A\u4E0A\u3052 - \u4F59\u308A;
6466
+ const \u540D\u524D = titlePlacement(node, { x: 26, y: 88 - \u305A\u3089\u3057, size: 26 }, { hasEyebrow: Boolean(node.eyebrow) });
6427
6467
  const scale = active ? 0.78 + 0.22 * progress : 0.92;
6428
6468
  const opacity = active ? 0.5 + 0.5 * progress : 0.65;
6429
6469
  return /* @__PURE__ */ jsx(
@@ -6446,7 +6486,7 @@ function EventNode({
6446
6486
  strokeWidth: active ? 3 : 1.25
6447
6487
  }
6448
6488
  ),
6449
- node.eyebrow && /* @__PURE__ */ jsx("text", { x: 26, y: 38, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
6489
+ node.eyebrow && /* @__PURE__ */ jsx("text", { x: 26, y: 38 - \u4F59\u308A, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
6450
6490
  /* @__PURE__ */ jsx(
6451
6491
  "text",
6452
6492
  {
@@ -6465,7 +6505,7 @@ function EventNode({
6465
6505
  "text",
6466
6506
  {
6467
6507
  x: 26,
6468
- y: 128 - \u7E70\u308A\u4E0A\u3052,
6508
+ y: 128 - \u305A\u3089\u3057,
6469
6509
  fontSize: 21,
6470
6510
  fill: "var(--cdl-text-dim, #5a6270)",
6471
6511
  style: { fontFamily: "'JetBrains Mono', monospace" },
@@ -6482,7 +6522,14 @@ function FunctionNode({ node, active }) {
6482
6522
  const x = node.cx - node.w / 2;
6483
6523
  const y = node.cy - node.h / 2;
6484
6524
  const \u7E70\u308A\u4E0A\u3052 = node.eyebrow ? 0 : \u76EE\u5370\u306A\u3057\u306E\u7E70\u308A\u4E0A\u3052("function");
6485
- const \u540D\u524D = titlePlacement(node, { x: 26, y: 86 - \u7E70\u308A\u4E0A\u3052, size: 24 }, { hasEyebrow: Boolean(node.eyebrow) });
6525
+ const \u4F59\u308A = \u4F59\u308A\u3092\u5206\u3051\u308B("function", NODE_SIZE.function.h, node.h, {
6526
+ hasEyebrow: Boolean(node.eyebrow),
6527
+ hasSubtitle: Boolean(node.subtitle),
6528
+ hasValue: false,
6529
+ hasRows: false
6530
+ });
6531
+ const \u305A\u3089\u3057 = \u7E70\u308A\u4E0A\u3052 - \u4F59\u308A;
6532
+ const \u540D\u524D = titlePlacement(node, { x: 26, y: 86 - \u305A\u3089\u3057, size: 24 }, { hasEyebrow: Boolean(node.eyebrow) });
6486
6533
  return /* @__PURE__ */ jsxs("g", { transform: `translate(${x} ${y})`, children: [
6487
6534
  /* @__PURE__ */ jsx(
6488
6535
  "rect",
@@ -6499,7 +6546,7 @@ function FunctionNode({ node, active }) {
6499
6546
  strokeOpacity: active ? 1 : 0.5
6500
6547
  }
6501
6548
  ),
6502
- node.eyebrow && /* @__PURE__ */ jsx("text", { x: 26, y: 38, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
6549
+ node.eyebrow && /* @__PURE__ */ jsx("text", { x: 26, y: 38 - \u4F59\u308A, fontSize: 18, fontWeight: 700, letterSpacing: 2, fill: accent, children: node.eyebrow }),
6503
6550
  /* @__PURE__ */ jsx(
6504
6551
  "text",
6505
6552
  {
@@ -6514,7 +6561,7 @@ function FunctionNode({ node, active }) {
6514
6561
  children: node.title
6515
6562
  }
6516
6563
  ),
6517
- node.subtitle && /* @__PURE__ */ jsx("text", { x: 26, y: 126 - \u7E70\u308A\u4E0A\u3052, fontSize: 20, fill: "var(--cdl-text-dim, #5a6270)", children: node.subtitle })
6564
+ node.subtitle && /* @__PURE__ */ jsx("text", { x: 26, y: 126 - \u305A\u3089\u3057, fontSize: 20, fill: "var(--cdl-text-dim, #5a6270)", children: node.subtitle })
6518
6565
  ] });
6519
6566
  }
6520
6567
  var ROW_GLYPH_HALF = 7;
@@ -6853,21 +6900,12 @@ function GenericNode({
6853
6900
  if (shape === "cloud") {
6854
6901
  const cx = w / 2;
6855
6902
  const cy = h / 2;
6856
- const cloudCenterY = cy - h * 0.05;
6857
- const usableW = w * 0.85;
6858
- const halfW = usableW / 2;
6859
- const circles = [
6860
- { cx: cx - halfW * 0.8, cy: cloudCenterY + h * 0.08, r: h * 0.32 },
6861
- // 左端
6862
- { cx: cx - halfW * 0.4, cy: cloudCenterY - h * 0.05, r: h * 0.4 },
6863
- // 左
6864
- { cx, cy: cloudCenterY - h * 0.1, r: h * 0.46 },
6865
- // 中央 (最大)
6866
- { cx: cx + halfW * 0.4, cy: cloudCenterY - h * 0.05, r: h * 0.4 },
6867
- // 右
6868
- { cx: cx + halfW * 0.8, cy: cloudCenterY + h * 0.08, r: h * 0.32 }
6869
- // 右端
6870
- ];
6903
+ const halfW = w * 0.85 / 2;
6904
+ const circles = CLOUD_CIRCLES.map((c) => ({
6905
+ cx: cx + halfW * c.cx,
6906
+ cy: cy + h * c.cy,
6907
+ r: h * c.r
6908
+ }));
6871
6909
  return /* @__PURE__ */ jsxs("g", { children: [
6872
6910
  circles.map((c, i) => /* @__PURE__ */ jsx("circle", { cx: c.cx, cy: c.cy, r: c.r, fill: "var(--cdl-node-fill, #ffffff)" }, `fill-${i}`)),
6873
6911
  circles.map((c, i) => /* @__PURE__ */ jsx(
@@ -6906,11 +6944,19 @@ function GenericNode({
6906
6944
  const textX = centered ? w / 2 : 20;
6907
6945
  const cylinderShift = genericTextShift(node.kind);
6908
6946
  const \u7E70\u308A\u4E0A\u3052 = node.eyebrow || centered ? 0 : \u76EE\u5370\u306A\u3057\u306E\u7E70\u308A\u4E0A\u3052(node.kind, hasRows);
6909
- const eyebrowY = centered ? h / 2 - 26 : 32 + cylinderShift;
6910
- const titleY = genericTitleBaselineY(node.kind, h, hasRows) - \u7E70\u308A\u4E0A\u3052;
6911
- const subtitleY = centered ? h / 2 + 28 : 96 + cylinderShift - \u7E70\u308A\u4E0A\u3052;
6947
+ const \u4F59\u308A = centered ? 0 : \u4F59\u308A\u3092\u5206\u3051\u308B(node.kind, NODE_SIZE[node.kind]?.h ?? h, h, {
6948
+ hasEyebrow: Boolean(node.eyebrow),
6949
+ hasSubtitle: Boolean(node.subtitle),
6950
+ hasValue: Boolean(resolvedValue),
6951
+ hasRows
6952
+ });
6953
+ const \u305A\u3089\u3057 = \u7E70\u308A\u4E0A\u3052 - \u4F59\u308A;
6954
+ const \u7D75\u306E\u82AF = centered && STYLES[node.kind]?.shape === "cloud" ? h * CLOUD_ART_CENTER_RISE : 0;
6955
+ const eyebrowY = centered ? h / 2 - 26 - \u7D75\u306E\u82AF : 32 + cylinderShift + \u4F59\u308A;
6956
+ const titleY = genericTitleBaselineY(node.kind, h, hasRows) - \u305A\u3089\u3057 - \u7D75\u306E\u82AF;
6957
+ const subtitleY = centered ? h / 2 + 28 - \u7D75\u306E\u82AF : 96 + cylinderShift - \u305A\u3089\u3057;
6912
6958
  const iconX = centered ? w / 2 + 40 : w - 48;
6913
- const iconY = centered ? h / 2 - 44 : 18 + cylinderShift;
6959
+ const iconY = centered ? h / 2 - 44 - \u7D75\u306E\u82AF : 18 + cylinderShift;
6914
6960
  const dominantBaseline = centered ? "middle" : void 0;
6915
6961
  return /* @__PURE__ */ jsxs("g", { transform: `translate(${x} ${y})`, "data-cdl-role": "node-body", children: [
6916
6962
  shapeEl,