@cardenelabs/cdl 0.11.0 → 0.12.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.cjs CHANGED
@@ -4886,7 +4886,16 @@ function nodeTemplateTexts(node) {
4886
4886
 
4887
4887
  // src/validate.ts
4888
4888
  var TONES2 = new Set(TONES);
4889
- var DRAW_KINDS = /* @__PURE__ */ new Set(["chart-line", "chart-bar", "chart-pie"]);
4889
+ var DRAW_KINDS = /* @__PURE__ */ new Set([
4890
+ "chart-line",
4891
+ "chart-bar",
4892
+ "chart-pie",
4893
+ "journey-map",
4894
+ "mind-map",
4895
+ "tree-hierarchy",
4896
+ "gantt-timeline",
4897
+ "funnel-stages"
4898
+ ]);
4890
4899
  var KINDS = new Set(NODE_KINDS);
4891
4900
  var ENG_BANNED = /\b(FUNCTION|STORAGE|EVENT LOG|BALANCES MAPPING|READ|WRITE|EMIT|CALL)\b/;
4892
4901
  function validate(diag) {
@@ -6584,6 +6593,44 @@ function resolveMindData(data, values) {
6584
6593
  const \u89E3\u6C7A\u5F8C = { ...data, rootTitle: root.value, branches };
6585
6594
  return root.ok ? \u89E3\u6C7A\u5F8C : { ...\u89E3\u6C7A\u5F8C, unresolved: true };
6586
6595
  }
6596
+
6597
+ // src/kinds/draw-progress.ts
6598
+ function \u9032\u307F\u3092\u7573\u3080(drawing, progress) {
6599
+ if (!drawing) return 1;
6600
+ return Math.min(1, Math.max(0, Number.isFinite(progress) ? progress : 1));
6601
+ }
6602
+ function \u4F38\u3070\u3059dash(drawing, \u4F38\u3073) {
6603
+ if (!drawing) return {};
6604
+ return { pathLength: 1, strokeDasharray: 1, strokeDashoffset: 1 - \u4F38\u3073 };
6605
+ }
6606
+ function \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, \u6DF1\u3055, \u6700\u5927\u6DF1\u3055) {
6607
+ if (\u6700\u5927\u6DF1\u3055 <= 0 || \u6DF1\u3055 <= 0) return 1;
6608
+ const \u5E45 = 1 / \u6700\u5927\u6DF1\u3055;
6609
+ const \u59CB\u307E\u308A = (\u6DF1\u3055 - 1) * \u5E45;
6610
+ return Math.min(1, Math.max(0, (\u4F38\u3073 - \u59CB\u307E\u308A) / \u5E45));
6611
+ }
6612
+ function \u30D9\u30B8\u30A8\u306E\u7D2F\u7A4D\u5272\u5408(\u70B9, \u5236\u5FA1\u70B9, \u5206\u5272\u6570 = 16) {
6613
+ if (\u70B9.length <= 1) return \u70B9.map(() => 0);
6614
+ const \u9577\u3055 = [0];
6615
+ let \u5408\u8A08 = 0;
6616
+ for (let i = 1; i < \u70B9.length; i++) {
6617
+ const p0 = \u70B9[i - 1];
6618
+ const p3 = \u70B9[i];
6619
+ const [p1, p2] = \u5236\u5FA1\u70B9(p0, p3);
6620
+ let \u524D = p0;
6621
+ for (let s = 1; s <= \u5206\u5272\u6570; s++) {
6622
+ const t = s / \u5206\u5272\u6570;
6623
+ const u = 1 - t;
6624
+ const x = u * u * u * p0.x + 3 * u * u * t * p1.x + 3 * u * t * t * p2.x + t * t * t * p3.x;
6625
+ const y = u * u * u * p0.y + 3 * u * u * t * p1.y + 3 * u * t * t * p2.y + t * t * t * p3.y;
6626
+ \u5408\u8A08 += Math.hypot(x - \u524D.x, y - \u524D.y);
6627
+ \u524D = { x, y };
6628
+ }
6629
+ \u9577\u3055.push(\u5408\u8A08);
6630
+ }
6631
+ if (\u5408\u8A08 === 0) return \u70B9.map(() => 0);
6632
+ return \u9577\u3055.map((l) => l / \u5408\u8A08);
6633
+ }
6587
6634
  function ChartLineNode({
6588
6635
  node,
6589
6636
  active,
@@ -6621,7 +6668,7 @@ function ChartLineNode({
6621
6668
  \u70B9\u307E\u3067\u306E\u9577\u3055.push(\u7DDA\u306E\u5168\u9577);
6622
6669
  \u524D\u306E\u70B9 = \u4ECA\u306E\u70B9;
6623
6670
  }
6624
- const \u4F38\u3073 = drawing ? Math.min(1, Math.max(0, Number.isFinite(progress) ? progress : 1)) : 1;
6671
+ const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
6625
6672
  const \u7DDA\u306E\u5148\u304C\u5C4A\u3044\u305F = (idx) => {
6626
6673
  if (!drawing) return true;
6627
6674
  if (data.length <= 1) return true;
@@ -6706,7 +6753,7 @@ function ChartLineNode({
6706
6753
  strokeWidth: 2.5,
6707
6754
  strokeLinejoin: "round",
6708
6755
  strokeLinecap: "round",
6709
- ...drawing ? { pathLength: 1, strokeDasharray: 1, strokeDashoffset: 1 - \u4F38\u3073 } : {}
6756
+ ...\u4F38\u3070\u3059dash(drawing, \u4F38\u3073)
6710
6757
  }
6711
6758
  ),
6712
6759
  data.map((d, idx) => {
@@ -6806,7 +6853,7 @@ function ChartPieNode({
6806
6853
  const path = `M ${cx} ${cy} L ${x1} ${y1} A ${radius} ${radius} 0 ${large} 1 ${x2} ${y2} Z`;
6807
6854
  return { d, frac, path, startFrac };
6808
6855
  });
6809
- const \u958B\u304D = drawing ? Math.min(1, Math.max(0, Number.isFinite(progress) ? progress : 1)) : 1;
6856
+ const \u958B\u304D = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
6810
6857
  const \u5207\u308A\u629C\u304Did = `cdl-pie-draw-${instanceId}`;
6811
6858
  const \u958B\u304D\u59CB\u3081\u305F = (startFrac) => !drawing || \u958B\u304D > startFrac;
6812
6859
  const legendX = pieAreaW + 8;
@@ -6921,7 +6968,7 @@ function ChartBarNode({
6921
6968
  const v = vMax * i / gridCount;
6922
6969
  return { y: yAt(v), value: v };
6923
6970
  });
6924
- const \u4F38\u3073 = drawing ? Math.min(1, Math.max(0, Number.isFinite(progress) ? progress : 1)) : 1;
6971
+ const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
6925
6972
  const \u6A2A\u8EF8\u306Ey = PAD_TOP + canvasH;
6926
6973
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
6927
6974
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -7025,7 +7072,9 @@ function ChartBarNode({
7025
7072
  function GanttNode({
7026
7073
  node,
7027
7074
  active,
7028
- stateValues = {}
7075
+ stateValues = {},
7076
+ drawing = false,
7077
+ progress = 1
7029
7078
  }) {
7030
7079
  const x0 = node.cx - node.w / 2;
7031
7080
  const y0 = node.cy - node.h / 2;
@@ -7084,6 +7133,7 @@ function GanttNode({
7084
7133
  const \u5E2F\u306E\u4F59\u767D = Math.min(6, cellW / 2);
7085
7134
  const \u5E2F\u306E\u5DE6 = (idx) => xAt(idx) + \u5E2F\u306E\u4F59\u767D / 2;
7086
7135
  const \u5E2F\u306E\u53F3 = (idx) => xAt(idx) + cellW - \u5E2F\u306E\u4F59\u767D / 2;
7136
+ const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
7087
7137
  const taskById = new Map(\u6574\u3048\u305F.map((t) => [t.id, t]));
7088
7138
  const rowOf = new Map(\u6574\u3048\u305F.map((t, i) => [t.id, i]));
7089
7139
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
@@ -7158,34 +7208,41 @@ function GanttNode({
7158
7208
  const bx = \u5E2F\u306E\u5DE6(t.startIdx);
7159
7209
  const by = yAt(row);
7160
7210
  const bw = Math.max(0, \u5E2F\u306E\u53F3(t.endIdx) - bx);
7161
- return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
7162
- /* @__PURE__ */ jsxRuntime.jsx(
7163
- "rect",
7164
- {
7165
- "data-cdl-role": "gantt-bar",
7166
- "data-cdl-unresolved": t.unresolved ? "true" : void 0,
7167
- "data-cdl-clipped": "clipped" in t && t.clipped ? "true" : void 0,
7168
- x: bx,
7169
- y: by,
7170
- width: bw,
7171
- height: rowH,
7172
- rx: 4,
7173
- fill: toneColor3(t.tone),
7174
- fillOpacity: 0.9
7175
- }
7176
- ),
7177
- t.owner && rowH >= 22 && /* @__PURE__ */ jsxRuntime.jsx(
7178
- "text",
7179
- {
7180
- x: bx + 8,
7181
- y: by + rowH / 2 + 4,
7182
- fontSize: 11,
7183
- fill: "var(--cdl-node-fill, #ffffff)",
7184
- fontWeight: 600,
7185
- children: t.owner
7186
- }
7187
- )
7188
- ] }, `bar-${t.id}`);
7211
+ return /* @__PURE__ */ jsxRuntime.jsxs(
7212
+ "g",
7213
+ {
7214
+ ...drawing ? { transform: `translate(${bx} 0) scale(${\u4F38\u3073} 1) translate(${-bx} 0)` } : {},
7215
+ children: [
7216
+ /* @__PURE__ */ jsxRuntime.jsx(
7217
+ "rect",
7218
+ {
7219
+ "data-cdl-role": "gantt-bar",
7220
+ "data-cdl-unresolved": t.unresolved ? "true" : void 0,
7221
+ "data-cdl-clipped": "clipped" in t && t.clipped ? "true" : void 0,
7222
+ x: bx,
7223
+ y: by,
7224
+ width: bw,
7225
+ height: rowH,
7226
+ rx: 4,
7227
+ fill: toneColor3(t.tone),
7228
+ fillOpacity: 0.9
7229
+ }
7230
+ ),
7231
+ t.owner && rowH >= 22 && /* @__PURE__ */ jsxRuntime.jsx(
7232
+ "text",
7233
+ {
7234
+ x: bx + 8,
7235
+ y: by + rowH / 2 + 4,
7236
+ fontSize: 11,
7237
+ fill: "var(--cdl-node-fill, #ffffff)",
7238
+ fontWeight: 600,
7239
+ children: t.owner
7240
+ }
7241
+ )
7242
+ ]
7243
+ },
7244
+ `bar-${t.id}`
7245
+ );
7189
7246
  }),
7190
7247
  \u6574\u3048\u305F.filter((t) => t.dependsOn && taskById.has(t.dependsOn)).map((t) => {
7191
7248
  const parent = taskById.get(t.dependsOn);
@@ -7205,29 +7262,33 @@ function GanttNode({
7205
7262
  const hasRoom = enterX - startX >= elbowGap;
7206
7263
  const path = hasRoom ? `M ${startX} ${parentMidY} L ${enterX} ${parentMidY} L ${enterX} ${tipY} L ${tipX} ${tipY}` : `M ${startX} ${parentMidY} L ${startX + elbowGap} ${parentMidY} L ${startX + elbowGap} ${(parentMidY + tipY) / 2} L ${enterX} ${(parentMidY + tipY) / 2} L ${enterX} ${tipY} L ${tipX} ${tipY}`;
7207
7264
  const arrowHeadPath = `M ${tipX + arrowHeadSize} ${tipY} L ${tipX} ${tipY - arrowHeadSize / 2} L ${tipX} ${tipY + arrowHeadSize / 2} Z`;
7208
- return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-role": "gantt-arrow", children: [
7209
- /* @__PURE__ */ jsxRuntime.jsx(
7210
- "path",
7211
- {
7212
- d: path,
7213
- fill: "none",
7214
- stroke: "var(--cdl-text-mute, #8a8678)",
7215
- strokeWidth: 1.75,
7216
- strokeLinejoin: "round",
7217
- strokeLinecap: "round"
7218
- }
7219
- ),
7220
- /* @__PURE__ */ jsxRuntime.jsx(
7221
- "path",
7222
- {
7223
- d: arrowHeadPath,
7224
- fill: "var(--cdl-text-mute, #8a8678)",
7225
- stroke: "var(--cdl-text-mute, #8a8678)",
7226
- strokeWidth: 0.5,
7227
- strokeLinejoin: "round"
7228
- }
7229
- )
7230
- ] }, `dep-${parent.id}-${t.id}`);
7265
+ return (
7266
+ // 矢印は両端の帯が出てから描く。 帯が無い場所へ矢印だけが伸びると、
7267
+ // 指す先の無い線になる (cdl#521)
7268
+ drawing && \u4F38\u3073 < 1 ? null : /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-role": "gantt-arrow", children: [
7269
+ /* @__PURE__ */ jsxRuntime.jsx(
7270
+ "path",
7271
+ {
7272
+ d: path,
7273
+ fill: "none",
7274
+ stroke: "var(--cdl-text-mute, #8a8678)",
7275
+ strokeWidth: 1.75,
7276
+ strokeLinejoin: "round",
7277
+ strokeLinecap: "round"
7278
+ }
7279
+ ),
7280
+ /* @__PURE__ */ jsxRuntime.jsx(
7281
+ "path",
7282
+ {
7283
+ d: arrowHeadPath,
7284
+ fill: "var(--cdl-text-mute, #8a8678)",
7285
+ stroke: "var(--cdl-text-mute, #8a8678)",
7286
+ strokeWidth: 0.5,
7287
+ strokeLinejoin: "round"
7288
+ }
7289
+ )
7290
+ ] }, `dep-${parent.id}-${t.id}`)
7291
+ );
7231
7292
  })
7232
7293
  ] });
7233
7294
  }
@@ -7283,7 +7344,9 @@ var MIND_BOX_GAP = 24;
7283
7344
  function MindMapNode({
7284
7345
  node,
7285
7346
  active,
7286
- stateValues = {}
7347
+ stateValues = {},
7348
+ drawing = false,
7349
+ progress = 1
7287
7350
  }) {
7288
7351
  const x0 = node.cx - node.w / 2;
7289
7352
  const y0 = node.cy - node.h / 2;
@@ -7295,6 +7358,9 @@ function MindMapNode({
7295
7358
  const canvasW = node.w - PAD * 2;
7296
7359
  const canvasH = node.h - PAD * 2;
7297
7360
  const layout2 = computeMindMapLayout(mindData, canvasCx, canvasCy, canvasW, canvasH);
7361
+ const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
7362
+ const \u6700\u5927\u6DF1\u3055 = layout2.nodes.reduce((m, n) => Math.max(m, n.depth), 0);
7363
+ const \u7BB1\u304C\u51FA\u308B = (\u6DF1\u3055) => !drawing || \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, \u6DF1\u3055, \u6700\u5927\u6DF1\u3055) >= 1;
7298
7364
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
7299
7365
  /* @__PURE__ */ jsxRuntime.jsx(
7300
7366
  "rect",
@@ -7310,20 +7376,25 @@ function MindMapNode({
7310
7376
  strokeWidth: active ? 3 : 1.25
7311
7377
  }
7312
7378
  ),
7313
- layout2.edges.map((e, i) => /* @__PURE__ */ jsxRuntime.jsx(
7314
- "path",
7315
- {
7316
- "data-cdl-role": "mind-edge",
7317
- d: e.d,
7318
- fill: "none",
7319
- stroke: toneColor4(e.tone),
7320
- strokeWidth: 2.5,
7321
- strokeOpacity: 0.55,
7322
- strokeLinecap: "round"
7323
- },
7324
- `edge-${i}`
7325
- )),
7379
+ layout2.edges.map((e, i) => {
7380
+ const \u679D\u306E\u4F38\u3073 = e.deferUntilComplete ? \u4F38\u3073 >= 1 ? 1 : 0 : \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, e.depth, \u6700\u5927\u6DF1\u3055);
7381
+ return /* @__PURE__ */ jsxRuntime.jsx(
7382
+ "path",
7383
+ {
7384
+ "data-cdl-role": "mind-edge",
7385
+ d: e.d,
7386
+ fill: "none",
7387
+ stroke: toneColor4(e.tone),
7388
+ strokeWidth: 2.5,
7389
+ strokeOpacity: 0.55,
7390
+ strokeLinecap: "round",
7391
+ ...\u4F38\u3070\u3059dash(drawing, \u679D\u306E\u4F38\u3073)
7392
+ },
7393
+ `edge-${i}`
7394
+ );
7395
+ }),
7326
7396
  layout2.nodes.map((n) => {
7397
+ if (!\u7BB1\u304C\u51FA\u308B(n.depth)) return null;
7327
7398
  const \u884C = \u7BB1\u306B\u7A4D\u3080(
7328
7399
  [
7329
7400
  { \u5F79\u5272: "title", text: n.title, fontSize: n.isRoot ? 15 : 13 },
@@ -7391,6 +7462,8 @@ function computeMindMapLayout(mindData, cx, cy, canvasW, canvasH) {
7391
7462
  w: rootW,
7392
7463
  h: rootH,
7393
7464
  isRoot: true,
7465
+ // 中心は起点なので段数 0 (cdl#520)
7466
+ depth: 0,
7394
7467
  ...mindData.unresolved ? { unresolved: true } : {}
7395
7468
  });
7396
7469
  const childrenOf = /* @__PURE__ */ new Map();
@@ -7502,6 +7575,8 @@ function computeMindMapLayout(mindData, cx, cy, canvasW, canvasH) {
7502
7575
  y,
7503
7576
  w,
7504
7577
  h,
7578
+ // 第 1 階層が段数 1 (`subDepth` は 0 始まり、 cdl#520)
7579
+ depth: subDepth + 1,
7505
7580
  tone: myTone,
7506
7581
  isRoot: false,
7507
7582
  ...node.unresolved ? { unresolved: true } : {}
@@ -7543,23 +7618,36 @@ function computeMindMapLayout(mindData, cx, cy, canvasW, canvasH) {
7543
7618
  }
7544
7619
  }
7545
7620
  }
7621
+ const \u6BB5\u6570 = new Map(nodes.map((n) => [n.id, n.depth]));
7546
7622
  for (const br of mindData.branches) {
7547
7623
  const childPos = nodePos.get(br.id);
7548
7624
  if (!childPos) continue;
7549
7625
  const isLeft = nodeSide.get(br.id) === "left";
7550
7626
  const childHalfW = nodeHalfW.get(br.id) ?? subBranchW / 2;
7551
7627
  const tone = nodeTone.get(br.id);
7628
+ const childDepth = \u6BB5\u6570.get(br.id) ?? 1;
7629
+ const parentDepth = \u6BB5\u6570.get(br.parent) ?? 0;
7552
7630
  if (br.parent === mindData.rootId) {
7553
7631
  const startX = rootEdgeXFor(isLeft);
7554
7632
  const endX = childPos.x + (isLeft ? childHalfW : -childHalfW);
7555
- edges.push({ d: makeCurve(startX, cy, endX, childPos.y), tone });
7633
+ edges.push({
7634
+ d: makeCurve(startX, cy, endX, childPos.y),
7635
+ tone,
7636
+ depth: childDepth,
7637
+ deferUntilComplete: false
7638
+ });
7556
7639
  } else {
7557
7640
  const parentPos = nodePos.get(br.parent);
7558
7641
  if (!parentPos) continue;
7559
7642
  const parentHalfW = nodeHalfW.get(br.parent) ?? branchW / 2;
7560
7643
  const startX = parentPos.x + (isLeft ? -parentHalfW : parentHalfW);
7561
7644
  const endX = childPos.x + (isLeft ? childHalfW : -childHalfW);
7562
- edges.push({ d: makeCurve(startX, parentPos.y, endX, childPos.y), tone });
7645
+ edges.push({
7646
+ d: makeCurve(startX, parentPos.y, endX, childPos.y),
7647
+ tone,
7648
+ depth: Math.max(parentDepth, childDepth),
7649
+ deferUntilComplete: parentDepth >= childDepth
7650
+ });
7563
7651
  }
7564
7652
  }
7565
7653
  return { nodes, edges };
@@ -7579,7 +7667,9 @@ function toneColor4(tone, alpha = 1) {
7579
7667
  function FunnelNode({
7580
7668
  node,
7581
7669
  active,
7582
- stateValues = {}
7670
+ stateValues = {},
7671
+ drawing = false,
7672
+ progress = 1
7583
7673
  }) {
7584
7674
  const x0 = node.cx - node.w / 2;
7585
7675
  const y0 = node.cy - node.h / 2;
@@ -7594,12 +7684,79 @@ function FunnelNode({
7594
7684
  const stageCount = stages.length || 1;
7595
7685
  const gap = 4;
7596
7686
  const stageH = (canvasH - gap * (stageCount - 1)) / stageCount;
7687
+ const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
7688
+ const \u5207\u308A\u629C\u304Did = `cdl-funnel-draw-${react.useId().replace(/[^A-Za-z0-9_-]/g, "")}`;
7689
+ const \u6BB5\u306E\u4E0B\u7AEF\u306E\u5272\u5408 = (idx) => {
7690
+ if (canvasH <= 0) return 0;
7691
+ return ((idx + 1) * stageH + idx * gap) / canvasH;
7692
+ };
7693
+ const \u6BB5\u304C\u51FA\u5207\u3063\u305F = (idx) => !drawing || \u4F38\u3073 >= \u6BB5\u306E\u4E0B\u7AEF\u306E\u5272\u5408(idx);
7597
7694
  const widthAtStep = (step) => {
7598
7695
  const topRatio = 1;
7599
7696
  const bottomRatio = 0.35;
7600
7697
  const t = step / stageCount;
7601
7698
  return canvasW * (topRatio + (bottomRatio - topRatio) * t);
7602
7699
  };
7700
+ const \u6BB5 = stages.map((s, idx) => {
7701
+ const prev = idx > 0 ? stages[idx - 1] : null;
7702
+ const dropRate = prev && prev.count > 0 ? (prev.count - s.count) / prev.count * 100 : 0;
7703
+ const y = PAD_TOP + idx * (stageH + gap);
7704
+ const topW = widthAtStep(idx);
7705
+ const bottomW = widthAtStep(idx + 1);
7706
+ const cx = PAD_LEFT + canvasW / 2;
7707
+ const topX = cx - topW / 2;
7708
+ const bottomX = cx - bottomW / 2;
7709
+ const points = `${topX},${y} ${topX + topW},${y} ${bottomX + bottomW},${y + stageH} ${bottomX},${y + stageH}`;
7710
+ const tone = toneByIndex(idx);
7711
+ const legendX = PAD_LEFT + canvasW + 24;
7712
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
7713
+ /* @__PURE__ */ jsxRuntime.jsx(
7714
+ "polygon",
7715
+ {
7716
+ "data-cdl-role": "funnel-stage",
7717
+ "data-cdl-unresolved": s.unresolved ? "true" : void 0,
7718
+ points,
7719
+ fill: tone,
7720
+ fillOpacity: 0.9,
7721
+ stroke: tone,
7722
+ strokeWidth: 0
7723
+ }
7724
+ ),
7725
+ /* @__PURE__ */ jsxRuntime.jsx(
7726
+ "text",
7727
+ {
7728
+ x: cx,
7729
+ y: y + stageH / 2 + 5,
7730
+ fontSize: 14,
7731
+ fontWeight: 700,
7732
+ textAnchor: "middle",
7733
+ fill: "var(--cdl-node-fill, #ffffff)",
7734
+ children: s.title
7735
+ }
7736
+ ),
7737
+ \u6BB5\u304C\u51FA\u5207\u3063\u305F(idx) && /* @__PURE__ */ jsxRuntime.jsx(
7738
+ "text",
7739
+ {
7740
+ x: legendX,
7741
+ y: y + stageH / 2 - 2,
7742
+ fontSize: 13,
7743
+ fontWeight: 700,
7744
+ fill: "var(--cdl-text, #1a1f2a)",
7745
+ children: s.count.toLocaleString()
7746
+ }
7747
+ ),
7748
+ \u6BB5\u304C\u51FA\u5207\u3063\u305F(idx) && prev && /* @__PURE__ */ jsxRuntime.jsx(
7749
+ "text",
7750
+ {
7751
+ x: legendX,
7752
+ y: y + stageH / 2 + 14,
7753
+ fontSize: 11,
7754
+ fill: dropRate > 0 ? "var(--cdl-text-dim, #5a6270)" : "var(--cdl-text-mute, #8a8678)",
7755
+ children: dropRate > 0 ? `\u2193 ${dropRate.toFixed(1)}%` : "\xB10%"
7756
+ }
7757
+ )
7758
+ ] }, `stage-${s.id}`);
7759
+ });
7603
7760
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
7604
7761
  /* @__PURE__ */ jsxRuntime.jsx(
7605
7762
  "rect",
@@ -7615,66 +7772,8 @@ function FunnelNode({
7615
7772
  strokeWidth: active ? 3 : 1.25
7616
7773
  }
7617
7774
  ),
7618
- stages.map((s, idx) => {
7619
- const prev = idx > 0 ? stages[idx - 1] : null;
7620
- const dropRate = prev && prev.count > 0 ? (prev.count - s.count) / prev.count * 100 : 0;
7621
- const y = PAD_TOP + idx * (stageH + gap);
7622
- const topW = widthAtStep(idx);
7623
- const bottomW = widthAtStep(idx + 1);
7624
- const cx = PAD_LEFT + canvasW / 2;
7625
- const topX = cx - topW / 2;
7626
- const bottomX = cx - bottomW / 2;
7627
- const points = `${topX},${y} ${topX + topW},${y} ${bottomX + bottomW},${y + stageH} ${bottomX},${y + stageH}`;
7628
- const tone = toneByIndex(idx);
7629
- const legendX = PAD_LEFT + canvasW + 24;
7630
- return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
7631
- /* @__PURE__ */ jsxRuntime.jsx(
7632
- "polygon",
7633
- {
7634
- "data-cdl-role": "funnel-stage",
7635
- "data-cdl-unresolved": s.unresolved ? "true" : void 0,
7636
- points,
7637
- fill: tone,
7638
- fillOpacity: 0.9,
7639
- stroke: tone,
7640
- strokeWidth: 0
7641
- }
7642
- ),
7643
- /* @__PURE__ */ jsxRuntime.jsx(
7644
- "text",
7645
- {
7646
- x: cx,
7647
- y: y + stageH / 2 + 5,
7648
- fontSize: 14,
7649
- fontWeight: 700,
7650
- textAnchor: "middle",
7651
- fill: "var(--cdl-node-fill, #ffffff)",
7652
- children: s.title
7653
- }
7654
- ),
7655
- /* @__PURE__ */ jsxRuntime.jsx(
7656
- "text",
7657
- {
7658
- x: legendX,
7659
- y: y + stageH / 2 - 2,
7660
- fontSize: 13,
7661
- fontWeight: 700,
7662
- fill: "var(--cdl-text, #1a1f2a)",
7663
- children: s.count.toLocaleString()
7664
- }
7665
- ),
7666
- prev && /* @__PURE__ */ jsxRuntime.jsx(
7667
- "text",
7668
- {
7669
- x: legendX,
7670
- y: y + stageH / 2 + 14,
7671
- fontSize: 11,
7672
- fill: dropRate > 0 ? "var(--cdl-text-dim, #5a6270)" : "var(--cdl-text-mute, #8a8678)",
7673
- children: dropRate > 0 ? `\u2193 ${dropRate.toFixed(1)}%` : "\xB10%"
7674
- }
7675
- )
7676
- ] }, `stage-${s.id}`);
7677
- })
7775
+ drawing && /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: \u5207\u308A\u629C\u304Did, children: /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 0, y: 0, width: node.w, height: PAD_TOP + canvasH * \u4F38\u3073 }) }) }),
7776
+ drawing ? /* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: `url(#${\u5207\u308A\u629C\u304Did})`, children: \u6BB5 }) : \u6BB5
7678
7777
  ] });
7679
7778
  }
7680
7779
  var TONE_ORDER = [
@@ -7860,7 +7959,9 @@ function \u7BB1\u306E\u6587\u5B57({
7860
7959
  function TreeNode({
7861
7960
  node,
7862
7961
  active,
7863
- stateValues = {}
7962
+ stateValues = {},
7963
+ drawing = false,
7964
+ progress = 1
7864
7965
  }) {
7865
7966
  const x0 = node.cx - node.w / 2;
7866
7967
  const y0 = node.cy - node.h / 2;
@@ -7873,6 +7974,9 @@ function TreeNode({
7873
7974
  const canvasW = node.w - PAD_LEFT - PAD_RIGHT;
7874
7975
  const canvasH = node.h - PAD_TOP - PAD_BOTTOM;
7875
7976
  const layout2 = computeTreeLayout(treeNodes, canvasW, canvasH);
7977
+ const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
7978
+ const \u6700\u5927\u6DF1\u3055 = layout2.nodes.reduce((m, n) => Math.max(m, n.depth), 0);
7979
+ const \u7BB1\u304C\u51FA\u308B = (\u6DF1\u3055) => !drawing || \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, \u6DF1\u3055, \u6700\u5927\u6DF1\u3055) >= 1;
7876
7980
  const depthColors = [TONE.accent, TONE.teal, TONE.success, TONE.warning, TONE.info];
7877
7981
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
7878
7982
  /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
@@ -7900,6 +8004,7 @@ function TreeNode({
7900
8004
  const y2 = PAD_TOP + e.y2;
7901
8005
  const midY = (y1 + y2) / 2;
7902
8006
  const path = `M ${x1} ${y1} L ${x1} ${midY} L ${x2} ${midY} L ${x2} ${y2}`;
8007
+ const \u679D\u306E\u4F38\u3073 = e.deferUntilComplete ? \u4F38\u3073 >= 1 ? 1 : 0 : \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, e.depth, \u6700\u5927\u6DF1\u3055);
7903
8008
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
7904
8009
  /* @__PURE__ */ jsxRuntime.jsx(
7905
8010
  "path",
@@ -7910,13 +8015,15 @@ function TreeNode({
7910
8015
  stroke: TONE.accent,
7911
8016
  strokeOpacity: 0.55,
7912
8017
  strokeWidth: 1.5,
7913
- strokeLinejoin: "round"
8018
+ strokeLinejoin: "round",
8019
+ ...\u4F38\u3070\u3059dash(drawing, \u679D\u306E\u4F38\u3073)
7914
8020
  }
7915
8021
  ),
7916
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x1, cy: midY, r: 2.5, fill: TONE.accent, fillOpacity: 0.75 })
8022
+ (!drawing || \u679D\u306E\u4F38\u3073 >= 1) && /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x1, cy: midY, r: 2.5, fill: TONE.accent, fillOpacity: 0.75 })
7917
8023
  ] }, `edge-${i}`);
7918
8024
  }),
7919
8025
  layout2.nodes.map((n) => {
8026
+ if (!\u7BB1\u304C\u51FA\u308B(n.depth)) return null;
7920
8027
  const accent = depthColors[Math.min(n.depth, depthColors.length - 1)] ?? depthColors[0];
7921
8028
  const isRoot = n.depth === 0;
7922
8029
  const \u884C = \u7BB1\u306B\u7A4D\u3080(
@@ -8097,6 +8204,7 @@ function computeTreeLayout(treeNodes, canvasW, canvasH) {
8097
8204
  }
8098
8205
  }
8099
8206
  const hById = new Map(nodes.map((n) => [n.id, n.h]));
8207
+ const \u6BB5\u6570 = new Map(nodes.map((n) => [n.id, n.depth]));
8100
8208
  const edges = [];
8101
8209
  for (const n of treeNodes) {
8102
8210
  if (!n.parent) continue;
@@ -8105,14 +8213,25 @@ function computeTreeLayout(treeNodes, canvasW, canvasH) {
8105
8213
  if (!parent || !child) continue;
8106
8214
  const parentH = hById.get(n.parent) ?? nodeH;
8107
8215
  const childH = hById.get(n.id) ?? nodeH;
8108
- edges.push({ x1: parent.x, y1: parent.y + parentH / 2, x2: child.x, y2: child.y - childH / 2 });
8216
+ const parentDepth = \u6BB5\u6570.get(n.parent) ?? 0;
8217
+ const childDepth = \u6BB5\u6570.get(n.id) ?? 1;
8218
+ edges.push({
8219
+ x1: parent.x,
8220
+ y1: parent.y + parentH / 2,
8221
+ x2: child.x,
8222
+ y2: child.y - childH / 2,
8223
+ depth: Math.max(parentDepth, childDepth),
8224
+ deferUntilComplete: parentDepth >= childDepth
8225
+ });
8109
8226
  }
8110
8227
  return { nodes, edges };
8111
8228
  }
8112
8229
  function UserJourneyNode({
8113
8230
  node,
8114
8231
  active,
8115
- stateValues = {}
8232
+ stateValues = {},
8233
+ drawing = false,
8234
+ progress = 1
8116
8235
  }) {
8117
8236
  const x0 = node.cx - node.w / 2;
8118
8237
  const y0 = node.cy - node.h / 2;
@@ -8150,6 +8269,12 @@ function UserJourneyNode({
8150
8269
  const xAt = (idx) => PAD_LEFT + (steps.length <= 1 ? canvasW / 2 : colW / 2 + colW * idx);
8151
8270
  const yAt = (emotion) => PAD_TOP + rowH / 2 + (4 - emotionScore[emotion]) * rowH;
8152
8271
  const pts = steps.map((s, i) => ({ x: xAt(i), y: yAt(s.emotion) }));
8272
+ const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
8273
+ const \u6BB5\u307E\u3067\u306E\u5272\u5408 = \u30D9\u30B8\u30A8\u306E\u7D2F\u7A4D\u5272\u5408(pts, (\u524D, \u5F8C) => {
8274
+ const midX = (\u524D.x + \u5F8C.x) / 2;
8275
+ return [{ x: midX, y: \u524D.y }, { x: midX, y: \u5F8C.y }];
8276
+ });
8277
+ const \u7DDA\u306E\u5148\u304C\u5C4A\u3044\u305F = (idx) => !drawing || \u4F38\u3073 >= (\u6BB5\u307E\u3067\u306E\u5272\u5408[idx] ?? 0);
8153
8278
  const smoothPath = pts.length > 1 ? pts.reduce((acc, p, i) => {
8154
8279
  if (i === 0) return `M ${p.x} ${p.y}`;
8155
8280
  const prev = pts[i - 1];
@@ -8230,7 +8355,8 @@ function UserJourneyNode({
8230
8355
  stroke: "var(--cdl-tone-accent, #2d6a8f)",
8231
8356
  strokeOpacity: 0.18,
8232
8357
  strokeWidth: 10,
8233
- strokeLinecap: "round"
8358
+ strokeLinecap: "round",
8359
+ ...\u4F38\u3070\u3059dash(drawing, \u4F38\u3073)
8234
8360
  }
8235
8361
  ),
8236
8362
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -8242,11 +8368,12 @@ function UserJourneyNode({
8242
8368
  stroke: "var(--cdl-tone-accent, #2d6a8f)",
8243
8369
  strokeWidth: 2.75,
8244
8370
  strokeLinejoin: "round",
8245
- strokeLinecap: "round"
8371
+ strokeLinecap: "round",
8372
+ ...\u4F38\u3070\u3059dash(drawing, \u4F38\u3073)
8246
8373
  }
8247
8374
  )
8248
8375
  ] }),
8249
- steps.map((s, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
8376
+ steps.map((s, idx) => !\u7DDA\u306E\u5148\u304C\u5C4A\u3044\u305F(idx) ? null : /* @__PURE__ */ jsxRuntime.jsxs(
8250
8377
  "g",
8251
8378
  {
8252
8379
  "data-cdl-role": "journey-step",
@@ -12337,17 +12464,62 @@ function CdlNodeView({
12337
12464
  }
12338
12465
  );
12339
12466
  case "gantt-timeline":
12340
- return /* @__PURE__ */ jsxRuntime.jsx(GanttNode, { node: resolvedNode, active, stateValues });
12467
+ return /* @__PURE__ */ jsxRuntime.jsx(
12468
+ GanttNode,
12469
+ {
12470
+ node: resolvedNode,
12471
+ active,
12472
+ stateValues,
12473
+ drawing,
12474
+ progress
12475
+ }
12476
+ );
12341
12477
  case "mind-map":
12342
- return /* @__PURE__ */ jsxRuntime.jsx(MindMapNode, { node: resolvedNode, active, stateValues });
12478
+ return /* @__PURE__ */ jsxRuntime.jsx(
12479
+ MindMapNode,
12480
+ {
12481
+ node: resolvedNode,
12482
+ active,
12483
+ stateValues,
12484
+ drawing,
12485
+ progress
12486
+ }
12487
+ );
12343
12488
  case "funnel-stages":
12344
- return /* @__PURE__ */ jsxRuntime.jsx(FunnelNode, { node: resolvedNode, active, stateValues });
12489
+ return /* @__PURE__ */ jsxRuntime.jsx(
12490
+ FunnelNode,
12491
+ {
12492
+ node: resolvedNode,
12493
+ active,
12494
+ stateValues,
12495
+ drawing,
12496
+ progress
12497
+ }
12498
+ );
12345
12499
  case "quadrant-matrix":
12346
12500
  return /* @__PURE__ */ jsxRuntime.jsx(QuadrantNode, { node: resolvedNode, active, stateValues });
12347
12501
  case "tree-hierarchy":
12348
- return /* @__PURE__ */ jsxRuntime.jsx(TreeNode, { node: resolvedNode, active, stateValues });
12502
+ return /* @__PURE__ */ jsxRuntime.jsx(
12503
+ TreeNode,
12504
+ {
12505
+ node: resolvedNode,
12506
+ active,
12507
+ stateValues,
12508
+ drawing,
12509
+ progress
12510
+ }
12511
+ );
12349
12512
  case "journey-map":
12350
- return /* @__PURE__ */ jsxRuntime.jsx(UserJourneyNode, { node: resolvedNode, active, stateValues });
12513
+ return /* @__PURE__ */ jsxRuntime.jsx(
12514
+ UserJourneyNode,
12515
+ {
12516
+ node: resolvedNode,
12517
+ active,
12518
+ stateValues,
12519
+ drawing,
12520
+ progress
12521
+ }
12522
+ );
12351
12523
  case "shape-file":
12352
12524
  return /* @__PURE__ */ jsxRuntime.jsx(ShapeFileNode, { node: resolvedNode, active });
12353
12525
  case "shape-folder":