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