@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/index.cjs CHANGED
@@ -15864,7 +15864,16 @@ function nodeTemplateTexts(node) {
15864
15864
 
15865
15865
  // src/validate.ts
15866
15866
  var TONES2 = new Set(TONES);
15867
- var DRAW_KINDS = /* @__PURE__ */ new Set(["chart-line", "chart-bar", "chart-pie"]);
15867
+ var DRAW_KINDS = /* @__PURE__ */ new Set([
15868
+ "chart-line",
15869
+ "chart-bar",
15870
+ "chart-pie",
15871
+ "journey-map",
15872
+ "mind-map",
15873
+ "tree-hierarchy",
15874
+ "gantt-timeline",
15875
+ "funnel-stages"
15876
+ ]);
15868
15877
  var KINDS = new Set(NODE_KINDS);
15869
15878
  var ENG_BANNED = /\b(FUNCTION|STORAGE|EVENT LOG|BALANCES MAPPING|READ|WRITE|EMIT|CALL)\b/;
15870
15879
  function validate(diag) {
@@ -21282,6 +21291,44 @@ function resolveMindData(data, values) {
21282
21291
  const \u89E3\u6C7A\u5F8C = { ...data, rootTitle: root.value, branches };
21283
21292
  return root.ok ? \u89E3\u6C7A\u5F8C : { ...\u89E3\u6C7A\u5F8C, unresolved: true };
21284
21293
  }
21294
+
21295
+ // src/kinds/draw-progress.ts
21296
+ function \u9032\u307F\u3092\u7573\u3080(drawing, progress) {
21297
+ if (!drawing) return 1;
21298
+ return Math.min(1, Math.max(0, Number.isFinite(progress) ? progress : 1));
21299
+ }
21300
+ function \u4F38\u3070\u3059dash(drawing, \u4F38\u3073) {
21301
+ if (!drawing) return {};
21302
+ return { pathLength: 1, strokeDasharray: 1, strokeDashoffset: 1 - \u4F38\u3073 };
21303
+ }
21304
+ function \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, \u6DF1\u3055, \u6700\u5927\u6DF1\u3055) {
21305
+ if (\u6700\u5927\u6DF1\u3055 <= 0 || \u6DF1\u3055 <= 0) return 1;
21306
+ const \u5E45 = 1 / \u6700\u5927\u6DF1\u3055;
21307
+ const \u59CB\u307E\u308A = (\u6DF1\u3055 - 1) * \u5E45;
21308
+ return Math.min(1, Math.max(0, (\u4F38\u3073 - \u59CB\u307E\u308A) / \u5E45));
21309
+ }
21310
+ function \u30D9\u30B8\u30A8\u306E\u7D2F\u7A4D\u5272\u5408(\u70B9, \u5236\u5FA1\u70B9, \u5206\u5272\u6570 = 16) {
21311
+ if (\u70B9.length <= 1) return \u70B9.map(() => 0);
21312
+ const \u9577\u3055 = [0];
21313
+ let \u5408\u8A08 = 0;
21314
+ for (let i = 1; i < \u70B9.length; i++) {
21315
+ const p0 = \u70B9[i - 1];
21316
+ const p3 = \u70B9[i];
21317
+ const [p1, p2] = \u5236\u5FA1\u70B9(p0, p3);
21318
+ let \u524D = p0;
21319
+ for (let s = 1; s <= \u5206\u5272\u6570; s++) {
21320
+ const t = s / \u5206\u5272\u6570;
21321
+ const u = 1 - t;
21322
+ const x = u * u * u * p0.x + 3 * u * u * t * p1.x + 3 * u * t * t * p2.x + t * t * t * p3.x;
21323
+ const y = u * u * u * p0.y + 3 * u * u * t * p1.y + 3 * u * t * t * p2.y + t * t * t * p3.y;
21324
+ \u5408\u8A08 += Math.hypot(x - \u524D.x, y - \u524D.y);
21325
+ \u524D = { x, y };
21326
+ }
21327
+ \u9577\u3055.push(\u5408\u8A08);
21328
+ }
21329
+ if (\u5408\u8A08 === 0) return \u70B9.map(() => 0);
21330
+ return \u9577\u3055.map((l) => l / \u5408\u8A08);
21331
+ }
21285
21332
  function ChartLineNode({
21286
21333
  node,
21287
21334
  active,
@@ -21319,7 +21366,7 @@ function ChartLineNode({
21319
21366
  \u70B9\u307E\u3067\u306E\u9577\u3055.push(\u7DDA\u306E\u5168\u9577);
21320
21367
  \u524D\u306E\u70B9 = \u4ECA\u306E\u70B9;
21321
21368
  }
21322
- const \u4F38\u3073 = drawing ? Math.min(1, Math.max(0, Number.isFinite(progress) ? progress : 1)) : 1;
21369
+ const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
21323
21370
  const \u7DDA\u306E\u5148\u304C\u5C4A\u3044\u305F = (idx) => {
21324
21371
  if (!drawing) return true;
21325
21372
  if (data.length <= 1) return true;
@@ -21404,7 +21451,7 @@ function ChartLineNode({
21404
21451
  strokeWidth: 2.5,
21405
21452
  strokeLinejoin: "round",
21406
21453
  strokeLinecap: "round",
21407
- ...drawing ? { pathLength: 1, strokeDasharray: 1, strokeDashoffset: 1 - \u4F38\u3073 } : {}
21454
+ ...\u4F38\u3070\u3059dash(drawing, \u4F38\u3073)
21408
21455
  }
21409
21456
  ),
21410
21457
  data.map((d, idx) => {
@@ -21504,7 +21551,7 @@ function ChartPieNode({
21504
21551
  const path = `M ${cx} ${cy} L ${x1} ${y1} A ${radius} ${radius} 0 ${large} 1 ${x2} ${y2} Z`;
21505
21552
  return { d, frac, path, startFrac };
21506
21553
  });
21507
- const \u958B\u304D = drawing ? Math.min(1, Math.max(0, Number.isFinite(progress) ? progress : 1)) : 1;
21554
+ const \u958B\u304D = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
21508
21555
  const \u5207\u308A\u629C\u304Did = `cdl-pie-draw-${instanceId}`;
21509
21556
  const \u958B\u304D\u59CB\u3081\u305F = (startFrac) => !drawing || \u958B\u304D > startFrac;
21510
21557
  const legendX = pieAreaW + 8;
@@ -21619,7 +21666,7 @@ function ChartBarNode({
21619
21666
  const v = vMax * i / gridCount;
21620
21667
  return { y: yAt(v), value: v };
21621
21668
  });
21622
- const \u4F38\u3073 = drawing ? Math.min(1, Math.max(0, Number.isFinite(progress) ? progress : 1)) : 1;
21669
+ const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
21623
21670
  const \u6A2A\u8EF8\u306Ey = PAD_TOP + canvasH;
21624
21671
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
21625
21672
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -21723,7 +21770,9 @@ function ChartBarNode({
21723
21770
  function GanttNode({
21724
21771
  node,
21725
21772
  active,
21726
- stateValues = {}
21773
+ stateValues = {},
21774
+ drawing = false,
21775
+ progress = 1
21727
21776
  }) {
21728
21777
  const x0 = node.cx - node.w / 2;
21729
21778
  const y0 = node.cy - node.h / 2;
@@ -21782,6 +21831,7 @@ function GanttNode({
21782
21831
  const \u5E2F\u306E\u4F59\u767D = Math.min(6, cellW / 2);
21783
21832
  const \u5E2F\u306E\u5DE6 = (idx) => xAt(idx) + \u5E2F\u306E\u4F59\u767D / 2;
21784
21833
  const \u5E2F\u306E\u53F3 = (idx) => xAt(idx) + cellW - \u5E2F\u306E\u4F59\u767D / 2;
21834
+ const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
21785
21835
  const taskById = new Map(\u6574\u3048\u305F.map((t) => [t.id, t]));
21786
21836
  const rowOf = new Map(\u6574\u3048\u305F.map((t, i) => [t.id, i]));
21787
21837
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
@@ -21856,34 +21906,41 @@ function GanttNode({
21856
21906
  const bx = \u5E2F\u306E\u5DE6(t.startIdx);
21857
21907
  const by = yAt(row);
21858
21908
  const bw = Math.max(0, \u5E2F\u306E\u53F3(t.endIdx) - bx);
21859
- return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
21860
- /* @__PURE__ */ jsxRuntime.jsx(
21861
- "rect",
21862
- {
21863
- "data-cdl-role": "gantt-bar",
21864
- "data-cdl-unresolved": t.unresolved ? "true" : void 0,
21865
- "data-cdl-clipped": "clipped" in t && t.clipped ? "true" : void 0,
21866
- x: bx,
21867
- y: by,
21868
- width: bw,
21869
- height: rowH,
21870
- rx: 4,
21871
- fill: toneColor3(t.tone),
21872
- fillOpacity: 0.9
21873
- }
21874
- ),
21875
- t.owner && rowH >= 22 && /* @__PURE__ */ jsxRuntime.jsx(
21876
- "text",
21877
- {
21878
- x: bx + 8,
21879
- y: by + rowH / 2 + 4,
21880
- fontSize: 11,
21881
- fill: "var(--cdl-node-fill, #ffffff)",
21882
- fontWeight: 600,
21883
- children: t.owner
21884
- }
21885
- )
21886
- ] }, `bar-${t.id}`);
21909
+ return /* @__PURE__ */ jsxRuntime.jsxs(
21910
+ "g",
21911
+ {
21912
+ ...drawing ? { transform: `translate(${bx} 0) scale(${\u4F38\u3073} 1) translate(${-bx} 0)` } : {},
21913
+ children: [
21914
+ /* @__PURE__ */ jsxRuntime.jsx(
21915
+ "rect",
21916
+ {
21917
+ "data-cdl-role": "gantt-bar",
21918
+ "data-cdl-unresolved": t.unresolved ? "true" : void 0,
21919
+ "data-cdl-clipped": "clipped" in t && t.clipped ? "true" : void 0,
21920
+ x: bx,
21921
+ y: by,
21922
+ width: bw,
21923
+ height: rowH,
21924
+ rx: 4,
21925
+ fill: toneColor3(t.tone),
21926
+ fillOpacity: 0.9
21927
+ }
21928
+ ),
21929
+ t.owner && rowH >= 22 && /* @__PURE__ */ jsxRuntime.jsx(
21930
+ "text",
21931
+ {
21932
+ x: bx + 8,
21933
+ y: by + rowH / 2 + 4,
21934
+ fontSize: 11,
21935
+ fill: "var(--cdl-node-fill, #ffffff)",
21936
+ fontWeight: 600,
21937
+ children: t.owner
21938
+ }
21939
+ )
21940
+ ]
21941
+ },
21942
+ `bar-${t.id}`
21943
+ );
21887
21944
  }),
21888
21945
  \u6574\u3048\u305F.filter((t) => t.dependsOn && taskById.has(t.dependsOn)).map((t) => {
21889
21946
  const parent = taskById.get(t.dependsOn);
@@ -21903,29 +21960,33 @@ function GanttNode({
21903
21960
  const hasRoom = enterX - startX >= elbowGap;
21904
21961
  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}`;
21905
21962
  const arrowHeadPath = `M ${tipX + arrowHeadSize} ${tipY} L ${tipX} ${tipY - arrowHeadSize / 2} L ${tipX} ${tipY + arrowHeadSize / 2} Z`;
21906
- return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-role": "gantt-arrow", children: [
21907
- /* @__PURE__ */ jsxRuntime.jsx(
21908
- "path",
21909
- {
21910
- d: path,
21911
- fill: "none",
21912
- stroke: "var(--cdl-text-mute, #8a8678)",
21913
- strokeWidth: 1.75,
21914
- strokeLinejoin: "round",
21915
- strokeLinecap: "round"
21916
- }
21917
- ),
21918
- /* @__PURE__ */ jsxRuntime.jsx(
21919
- "path",
21920
- {
21921
- d: arrowHeadPath,
21922
- fill: "var(--cdl-text-mute, #8a8678)",
21923
- stroke: "var(--cdl-text-mute, #8a8678)",
21924
- strokeWidth: 0.5,
21925
- strokeLinejoin: "round"
21926
- }
21927
- )
21928
- ] }, `dep-${parent.id}-${t.id}`);
21963
+ return (
21964
+ // 矢印は両端の帯が出てから描く。 帯が無い場所へ矢印だけが伸びると、
21965
+ // 指す先の無い線になる (cdl#521)
21966
+ drawing && \u4F38\u3073 < 1 ? null : /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-role": "gantt-arrow", children: [
21967
+ /* @__PURE__ */ jsxRuntime.jsx(
21968
+ "path",
21969
+ {
21970
+ d: path,
21971
+ fill: "none",
21972
+ stroke: "var(--cdl-text-mute, #8a8678)",
21973
+ strokeWidth: 1.75,
21974
+ strokeLinejoin: "round",
21975
+ strokeLinecap: "round"
21976
+ }
21977
+ ),
21978
+ /* @__PURE__ */ jsxRuntime.jsx(
21979
+ "path",
21980
+ {
21981
+ d: arrowHeadPath,
21982
+ fill: "var(--cdl-text-mute, #8a8678)",
21983
+ stroke: "var(--cdl-text-mute, #8a8678)",
21984
+ strokeWidth: 0.5,
21985
+ strokeLinejoin: "round"
21986
+ }
21987
+ )
21988
+ ] }, `dep-${parent.id}-${t.id}`)
21989
+ );
21929
21990
  })
21930
21991
  ] });
21931
21992
  }
@@ -21981,7 +22042,9 @@ var MIND_BOX_GAP = 24;
21981
22042
  function MindMapNode({
21982
22043
  node,
21983
22044
  active,
21984
- stateValues = {}
22045
+ stateValues = {},
22046
+ drawing = false,
22047
+ progress = 1
21985
22048
  }) {
21986
22049
  const x0 = node.cx - node.w / 2;
21987
22050
  const y0 = node.cy - node.h / 2;
@@ -21993,6 +22056,9 @@ function MindMapNode({
21993
22056
  const canvasW = node.w - PAD * 2;
21994
22057
  const canvasH = node.h - PAD * 2;
21995
22058
  const layout2 = computeMindMapLayout(mindData, canvasCx, canvasCy, canvasW, canvasH);
22059
+ const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
22060
+ const \u6700\u5927\u6DF1\u3055 = layout2.nodes.reduce((m, n) => Math.max(m, n.depth), 0);
22061
+ const \u7BB1\u304C\u51FA\u308B = (\u6DF1\u3055) => !drawing || \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, \u6DF1\u3055, \u6700\u5927\u6DF1\u3055) >= 1;
21996
22062
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
21997
22063
  /* @__PURE__ */ jsxRuntime.jsx(
21998
22064
  "rect",
@@ -22008,20 +22074,25 @@ function MindMapNode({
22008
22074
  strokeWidth: active ? 3 : 1.25
22009
22075
  }
22010
22076
  ),
22011
- layout2.edges.map((e, i) => /* @__PURE__ */ jsxRuntime.jsx(
22012
- "path",
22013
- {
22014
- "data-cdl-role": "mind-edge",
22015
- d: e.d,
22016
- fill: "none",
22017
- stroke: toneColor4(e.tone),
22018
- strokeWidth: 2.5,
22019
- strokeOpacity: 0.55,
22020
- strokeLinecap: "round"
22021
- },
22022
- `edge-${i}`
22023
- )),
22077
+ layout2.edges.map((e, i) => {
22078
+ const \u679D\u306E\u4F38\u3073 = e.deferUntilComplete ? \u4F38\u3073 >= 1 ? 1 : 0 : \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, e.depth, \u6700\u5927\u6DF1\u3055);
22079
+ return /* @__PURE__ */ jsxRuntime.jsx(
22080
+ "path",
22081
+ {
22082
+ "data-cdl-role": "mind-edge",
22083
+ d: e.d,
22084
+ fill: "none",
22085
+ stroke: toneColor4(e.tone),
22086
+ strokeWidth: 2.5,
22087
+ strokeOpacity: 0.55,
22088
+ strokeLinecap: "round",
22089
+ ...\u4F38\u3070\u3059dash(drawing, \u679D\u306E\u4F38\u3073)
22090
+ },
22091
+ `edge-${i}`
22092
+ );
22093
+ }),
22024
22094
  layout2.nodes.map((n) => {
22095
+ if (!\u7BB1\u304C\u51FA\u308B(n.depth)) return null;
22025
22096
  const \u884C = \u7BB1\u306B\u7A4D\u3080(
22026
22097
  [
22027
22098
  { \u5F79\u5272: "title", text: n.title, fontSize: n.isRoot ? 15 : 13 },
@@ -22089,6 +22160,8 @@ function computeMindMapLayout(mindData, cx, cy, canvasW, canvasH) {
22089
22160
  w: rootW,
22090
22161
  h: rootH,
22091
22162
  isRoot: true,
22163
+ // 中心は起点なので段数 0 (cdl#520)
22164
+ depth: 0,
22092
22165
  ...mindData.unresolved ? { unresolved: true } : {}
22093
22166
  });
22094
22167
  const childrenOf = /* @__PURE__ */ new Map();
@@ -22200,6 +22273,8 @@ function computeMindMapLayout(mindData, cx, cy, canvasW, canvasH) {
22200
22273
  y,
22201
22274
  w,
22202
22275
  h,
22276
+ // 第 1 階層が段数 1 (`subDepth` は 0 始まり、 cdl#520)
22277
+ depth: subDepth + 1,
22203
22278
  tone: myTone,
22204
22279
  isRoot: false,
22205
22280
  ...node.unresolved ? { unresolved: true } : {}
@@ -22241,23 +22316,36 @@ function computeMindMapLayout(mindData, cx, cy, canvasW, canvasH) {
22241
22316
  }
22242
22317
  }
22243
22318
  }
22319
+ const \u6BB5\u6570 = new Map(nodes.map((n) => [n.id, n.depth]));
22244
22320
  for (const br of mindData.branches) {
22245
22321
  const childPos = nodePos.get(br.id);
22246
22322
  if (!childPos) continue;
22247
22323
  const isLeft = nodeSide.get(br.id) === "left";
22248
22324
  const childHalfW = nodeHalfW.get(br.id) ?? subBranchW / 2;
22249
22325
  const tone = nodeTone.get(br.id);
22326
+ const childDepth = \u6BB5\u6570.get(br.id) ?? 1;
22327
+ const parentDepth = \u6BB5\u6570.get(br.parent) ?? 0;
22250
22328
  if (br.parent === mindData.rootId) {
22251
22329
  const startX = rootEdgeXFor(isLeft);
22252
22330
  const endX = childPos.x + (isLeft ? childHalfW : -childHalfW);
22253
- edges.push({ d: makeCurve(startX, cy, endX, childPos.y), tone });
22331
+ edges.push({
22332
+ d: makeCurve(startX, cy, endX, childPos.y),
22333
+ tone,
22334
+ depth: childDepth,
22335
+ deferUntilComplete: false
22336
+ });
22254
22337
  } else {
22255
22338
  const parentPos = nodePos.get(br.parent);
22256
22339
  if (!parentPos) continue;
22257
22340
  const parentHalfW = nodeHalfW.get(br.parent) ?? branchW / 2;
22258
22341
  const startX = parentPos.x + (isLeft ? -parentHalfW : parentHalfW);
22259
22342
  const endX = childPos.x + (isLeft ? childHalfW : -childHalfW);
22260
- edges.push({ d: makeCurve(startX, parentPos.y, endX, childPos.y), tone });
22343
+ edges.push({
22344
+ d: makeCurve(startX, parentPos.y, endX, childPos.y),
22345
+ tone,
22346
+ depth: Math.max(parentDepth, childDepth),
22347
+ deferUntilComplete: parentDepth >= childDepth
22348
+ });
22261
22349
  }
22262
22350
  }
22263
22351
  return { nodes, edges };
@@ -22277,7 +22365,9 @@ function toneColor4(tone, alpha = 1) {
22277
22365
  function FunnelNode({
22278
22366
  node,
22279
22367
  active,
22280
- stateValues = {}
22368
+ stateValues = {},
22369
+ drawing = false,
22370
+ progress = 1
22281
22371
  }) {
22282
22372
  const x0 = node.cx - node.w / 2;
22283
22373
  const y0 = node.cy - node.h / 2;
@@ -22292,12 +22382,79 @@ function FunnelNode({
22292
22382
  const stageCount = stages.length || 1;
22293
22383
  const gap = 4;
22294
22384
  const stageH = (canvasH - gap * (stageCount - 1)) / stageCount;
22385
+ const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
22386
+ const \u5207\u308A\u629C\u304Did = `cdl-funnel-draw-${react.useId().replace(/[^A-Za-z0-9_-]/g, "")}`;
22387
+ const \u6BB5\u306E\u4E0B\u7AEF\u306E\u5272\u5408 = (idx) => {
22388
+ if (canvasH <= 0) return 0;
22389
+ return ((idx + 1) * stageH + idx * gap) / canvasH;
22390
+ };
22391
+ const \u6BB5\u304C\u51FA\u5207\u3063\u305F = (idx) => !drawing || \u4F38\u3073 >= \u6BB5\u306E\u4E0B\u7AEF\u306E\u5272\u5408(idx);
22295
22392
  const widthAtStep = (step) => {
22296
22393
  const topRatio = 1;
22297
22394
  const bottomRatio = 0.35;
22298
22395
  const t = step / stageCount;
22299
22396
  return canvasW * (topRatio + (bottomRatio - topRatio) * t);
22300
22397
  };
22398
+ const \u6BB5 = stages.map((s, idx) => {
22399
+ const prev = idx > 0 ? stages[idx - 1] : null;
22400
+ const dropRate = prev && prev.count > 0 ? (prev.count - s.count) / prev.count * 100 : 0;
22401
+ const y = PAD_TOP + idx * (stageH + gap);
22402
+ const topW = widthAtStep(idx);
22403
+ const bottomW = widthAtStep(idx + 1);
22404
+ const cx = PAD_LEFT + canvasW / 2;
22405
+ const topX = cx - topW / 2;
22406
+ const bottomX = cx - bottomW / 2;
22407
+ const points = `${topX},${y} ${topX + topW},${y} ${bottomX + bottomW},${y + stageH} ${bottomX},${y + stageH}`;
22408
+ const tone = toneByIndex(idx);
22409
+ const legendX = PAD_LEFT + canvasW + 24;
22410
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
22411
+ /* @__PURE__ */ jsxRuntime.jsx(
22412
+ "polygon",
22413
+ {
22414
+ "data-cdl-role": "funnel-stage",
22415
+ "data-cdl-unresolved": s.unresolved ? "true" : void 0,
22416
+ points,
22417
+ fill: tone,
22418
+ fillOpacity: 0.9,
22419
+ stroke: tone,
22420
+ strokeWidth: 0
22421
+ }
22422
+ ),
22423
+ /* @__PURE__ */ jsxRuntime.jsx(
22424
+ "text",
22425
+ {
22426
+ x: cx,
22427
+ y: y + stageH / 2 + 5,
22428
+ fontSize: 14,
22429
+ fontWeight: 700,
22430
+ textAnchor: "middle",
22431
+ fill: "var(--cdl-node-fill, #ffffff)",
22432
+ children: s.title
22433
+ }
22434
+ ),
22435
+ \u6BB5\u304C\u51FA\u5207\u3063\u305F(idx) && /* @__PURE__ */ jsxRuntime.jsx(
22436
+ "text",
22437
+ {
22438
+ x: legendX,
22439
+ y: y + stageH / 2 - 2,
22440
+ fontSize: 13,
22441
+ fontWeight: 700,
22442
+ fill: "var(--cdl-text, #1a1f2a)",
22443
+ children: s.count.toLocaleString()
22444
+ }
22445
+ ),
22446
+ \u6BB5\u304C\u51FA\u5207\u3063\u305F(idx) && prev && /* @__PURE__ */ jsxRuntime.jsx(
22447
+ "text",
22448
+ {
22449
+ x: legendX,
22450
+ y: y + stageH / 2 + 14,
22451
+ fontSize: 11,
22452
+ fill: dropRate > 0 ? "var(--cdl-text-dim, #5a6270)" : "var(--cdl-text-mute, #8a8678)",
22453
+ children: dropRate > 0 ? `\u2193 ${dropRate.toFixed(1)}%` : "\xB10%"
22454
+ }
22455
+ )
22456
+ ] }, `stage-${s.id}`);
22457
+ });
22301
22458
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
22302
22459
  /* @__PURE__ */ jsxRuntime.jsx(
22303
22460
  "rect",
@@ -22313,66 +22470,8 @@ function FunnelNode({
22313
22470
  strokeWidth: active ? 3 : 1.25
22314
22471
  }
22315
22472
  ),
22316
- stages.map((s, idx) => {
22317
- const prev = idx > 0 ? stages[idx - 1] : null;
22318
- const dropRate = prev && prev.count > 0 ? (prev.count - s.count) / prev.count * 100 : 0;
22319
- const y = PAD_TOP + idx * (stageH + gap);
22320
- const topW = widthAtStep(idx);
22321
- const bottomW = widthAtStep(idx + 1);
22322
- const cx = PAD_LEFT + canvasW / 2;
22323
- const topX = cx - topW / 2;
22324
- const bottomX = cx - bottomW / 2;
22325
- const points = `${topX},${y} ${topX + topW},${y} ${bottomX + bottomW},${y + stageH} ${bottomX},${y + stageH}`;
22326
- const tone = toneByIndex(idx);
22327
- const legendX = PAD_LEFT + canvasW + 24;
22328
- return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
22329
- /* @__PURE__ */ jsxRuntime.jsx(
22330
- "polygon",
22331
- {
22332
- "data-cdl-role": "funnel-stage",
22333
- "data-cdl-unresolved": s.unresolved ? "true" : void 0,
22334
- points,
22335
- fill: tone,
22336
- fillOpacity: 0.9,
22337
- stroke: tone,
22338
- strokeWidth: 0
22339
- }
22340
- ),
22341
- /* @__PURE__ */ jsxRuntime.jsx(
22342
- "text",
22343
- {
22344
- x: cx,
22345
- y: y + stageH / 2 + 5,
22346
- fontSize: 14,
22347
- fontWeight: 700,
22348
- textAnchor: "middle",
22349
- fill: "var(--cdl-node-fill, #ffffff)",
22350
- children: s.title
22351
- }
22352
- ),
22353
- /* @__PURE__ */ jsxRuntime.jsx(
22354
- "text",
22355
- {
22356
- x: legendX,
22357
- y: y + stageH / 2 - 2,
22358
- fontSize: 13,
22359
- fontWeight: 700,
22360
- fill: "var(--cdl-text, #1a1f2a)",
22361
- children: s.count.toLocaleString()
22362
- }
22363
- ),
22364
- prev && /* @__PURE__ */ jsxRuntime.jsx(
22365
- "text",
22366
- {
22367
- x: legendX,
22368
- y: y + stageH / 2 + 14,
22369
- fontSize: 11,
22370
- fill: dropRate > 0 ? "var(--cdl-text-dim, #5a6270)" : "var(--cdl-text-mute, #8a8678)",
22371
- children: dropRate > 0 ? `\u2193 ${dropRate.toFixed(1)}%` : "\xB10%"
22372
- }
22373
- )
22374
- ] }, `stage-${s.id}`);
22375
- })
22473
+ 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 }) }) }),
22474
+ drawing ? /* @__PURE__ */ jsxRuntime.jsx("g", { clipPath: `url(#${\u5207\u308A\u629C\u304Did})`, children: \u6BB5 }) : \u6BB5
22376
22475
  ] });
22377
22476
  }
22378
22477
  var TONE_ORDER = [
@@ -22558,7 +22657,9 @@ function \u7BB1\u306E\u6587\u5B57({
22558
22657
  function TreeNode({
22559
22658
  node,
22560
22659
  active,
22561
- stateValues = {}
22660
+ stateValues = {},
22661
+ drawing = false,
22662
+ progress = 1
22562
22663
  }) {
22563
22664
  const x0 = node.cx - node.w / 2;
22564
22665
  const y0 = node.cy - node.h / 2;
@@ -22571,6 +22672,9 @@ function TreeNode({
22571
22672
  const canvasW = node.w - PAD_LEFT - PAD_RIGHT;
22572
22673
  const canvasH = node.h - PAD_TOP - PAD_BOTTOM;
22573
22674
  const layout2 = computeTreeLayout(treeNodes, canvasW, canvasH);
22675
+ const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
22676
+ const \u6700\u5927\u6DF1\u3055 = layout2.nodes.reduce((m, n) => Math.max(m, n.depth), 0);
22677
+ const \u7BB1\u304C\u51FA\u308B = (\u6DF1\u3055) => !drawing || \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, \u6DF1\u3055, \u6700\u5927\u6DF1\u3055) >= 1;
22574
22678
  const depthColors = [TONE.accent, TONE.teal, TONE.success, TONE.warning, TONE.info];
22575
22679
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
22576
22680
  /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
@@ -22598,6 +22702,7 @@ function TreeNode({
22598
22702
  const y2 = PAD_TOP + e.y2;
22599
22703
  const midY = (y1 + y2) / 2;
22600
22704
  const path = `M ${x1} ${y1} L ${x1} ${midY} L ${x2} ${midY} L ${x2} ${y2}`;
22705
+ const \u679D\u306E\u4F38\u3073 = e.deferUntilComplete ? \u4F38\u3073 >= 1 ? 1 : 0 : \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, e.depth, \u6700\u5927\u6DF1\u3055);
22601
22706
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
22602
22707
  /* @__PURE__ */ jsxRuntime.jsx(
22603
22708
  "path",
@@ -22608,13 +22713,15 @@ function TreeNode({
22608
22713
  stroke: TONE.accent,
22609
22714
  strokeOpacity: 0.55,
22610
22715
  strokeWidth: 1.5,
22611
- strokeLinejoin: "round"
22716
+ strokeLinejoin: "round",
22717
+ ...\u4F38\u3070\u3059dash(drawing, \u679D\u306E\u4F38\u3073)
22612
22718
  }
22613
22719
  ),
22614
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x1, cy: midY, r: 2.5, fill: TONE.accent, fillOpacity: 0.75 })
22720
+ (!drawing || \u679D\u306E\u4F38\u3073 >= 1) && /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x1, cy: midY, r: 2.5, fill: TONE.accent, fillOpacity: 0.75 })
22615
22721
  ] }, `edge-${i}`);
22616
22722
  }),
22617
22723
  layout2.nodes.map((n) => {
22724
+ if (!\u7BB1\u304C\u51FA\u308B(n.depth)) return null;
22618
22725
  const accent = depthColors[Math.min(n.depth, depthColors.length - 1)] ?? depthColors[0];
22619
22726
  const isRoot = n.depth === 0;
22620
22727
  const \u884C = \u7BB1\u306B\u7A4D\u3080(
@@ -22795,6 +22902,7 @@ function computeTreeLayout(treeNodes, canvasW, canvasH) {
22795
22902
  }
22796
22903
  }
22797
22904
  const hById = new Map(nodes.map((n) => [n.id, n.h]));
22905
+ const \u6BB5\u6570 = new Map(nodes.map((n) => [n.id, n.depth]));
22798
22906
  const edges = [];
22799
22907
  for (const n of treeNodes) {
22800
22908
  if (!n.parent) continue;
@@ -22803,14 +22911,25 @@ function computeTreeLayout(treeNodes, canvasW, canvasH) {
22803
22911
  if (!parent || !child) continue;
22804
22912
  const parentH = hById.get(n.parent) ?? nodeH;
22805
22913
  const childH = hById.get(n.id) ?? nodeH;
22806
- edges.push({ x1: parent.x, y1: parent.y + parentH / 2, x2: child.x, y2: child.y - childH / 2 });
22914
+ const parentDepth = \u6BB5\u6570.get(n.parent) ?? 0;
22915
+ const childDepth = \u6BB5\u6570.get(n.id) ?? 1;
22916
+ edges.push({
22917
+ x1: parent.x,
22918
+ y1: parent.y + parentH / 2,
22919
+ x2: child.x,
22920
+ y2: child.y - childH / 2,
22921
+ depth: Math.max(parentDepth, childDepth),
22922
+ deferUntilComplete: parentDepth >= childDepth
22923
+ });
22807
22924
  }
22808
22925
  return { nodes, edges };
22809
22926
  }
22810
22927
  function UserJourneyNode({
22811
22928
  node,
22812
22929
  active,
22813
- stateValues = {}
22930
+ stateValues = {},
22931
+ drawing = false,
22932
+ progress = 1
22814
22933
  }) {
22815
22934
  const x0 = node.cx - node.w / 2;
22816
22935
  const y0 = node.cy - node.h / 2;
@@ -22848,6 +22967,12 @@ function UserJourneyNode({
22848
22967
  const xAt = (idx) => PAD_LEFT + (steps.length <= 1 ? canvasW / 2 : colW / 2 + colW * idx);
22849
22968
  const yAt = (emotion) => PAD_TOP + rowH / 2 + (4 - emotionScore[emotion]) * rowH;
22850
22969
  const pts = steps.map((s, i) => ({ x: xAt(i), y: yAt(s.emotion) }));
22970
+ const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
22971
+ const \u6BB5\u307E\u3067\u306E\u5272\u5408 = \u30D9\u30B8\u30A8\u306E\u7D2F\u7A4D\u5272\u5408(pts, (\u524D, \u5F8C) => {
22972
+ const midX = (\u524D.x + \u5F8C.x) / 2;
22973
+ return [{ x: midX, y: \u524D.y }, { x: midX, y: \u5F8C.y }];
22974
+ });
22975
+ const \u7DDA\u306E\u5148\u304C\u5C4A\u3044\u305F = (idx) => !drawing || \u4F38\u3073 >= (\u6BB5\u307E\u3067\u306E\u5272\u5408[idx] ?? 0);
22851
22976
  const smoothPath = pts.length > 1 ? pts.reduce((acc, p, i) => {
22852
22977
  if (i === 0) return `M ${p.x} ${p.y}`;
22853
22978
  const prev = pts[i - 1];
@@ -22928,7 +23053,8 @@ function UserJourneyNode({
22928
23053
  stroke: "var(--cdl-tone-accent, #2d6a8f)",
22929
23054
  strokeOpacity: 0.18,
22930
23055
  strokeWidth: 10,
22931
- strokeLinecap: "round"
23056
+ strokeLinecap: "round",
23057
+ ...\u4F38\u3070\u3059dash(drawing, \u4F38\u3073)
22932
23058
  }
22933
23059
  ),
22934
23060
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -22940,11 +23066,12 @@ function UserJourneyNode({
22940
23066
  stroke: "var(--cdl-tone-accent, #2d6a8f)",
22941
23067
  strokeWidth: 2.75,
22942
23068
  strokeLinejoin: "round",
22943
- strokeLinecap: "round"
23069
+ strokeLinecap: "round",
23070
+ ...\u4F38\u3070\u3059dash(drawing, \u4F38\u3073)
22944
23071
  }
22945
23072
  )
22946
23073
  ] }),
22947
- steps.map((s, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
23074
+ steps.map((s, idx) => !\u7DDA\u306E\u5148\u304C\u5C4A\u3044\u305F(idx) ? null : /* @__PURE__ */ jsxRuntime.jsxs(
22948
23075
  "g",
22949
23076
  {
22950
23077
  "data-cdl-role": "journey-step",
@@ -26854,17 +26981,62 @@ function CdlNodeView({
26854
26981
  }
26855
26982
  );
26856
26983
  case "gantt-timeline":
26857
- return /* @__PURE__ */ jsxRuntime.jsx(GanttNode, { node: resolvedNode, active, stateValues });
26984
+ return /* @__PURE__ */ jsxRuntime.jsx(
26985
+ GanttNode,
26986
+ {
26987
+ node: resolvedNode,
26988
+ active,
26989
+ stateValues,
26990
+ drawing,
26991
+ progress
26992
+ }
26993
+ );
26858
26994
  case "mind-map":
26859
- return /* @__PURE__ */ jsxRuntime.jsx(MindMapNode, { node: resolvedNode, active, stateValues });
26995
+ return /* @__PURE__ */ jsxRuntime.jsx(
26996
+ MindMapNode,
26997
+ {
26998
+ node: resolvedNode,
26999
+ active,
27000
+ stateValues,
27001
+ drawing,
27002
+ progress
27003
+ }
27004
+ );
26860
27005
  case "funnel-stages":
26861
- return /* @__PURE__ */ jsxRuntime.jsx(FunnelNode, { node: resolvedNode, active, stateValues });
27006
+ return /* @__PURE__ */ jsxRuntime.jsx(
27007
+ FunnelNode,
27008
+ {
27009
+ node: resolvedNode,
27010
+ active,
27011
+ stateValues,
27012
+ drawing,
27013
+ progress
27014
+ }
27015
+ );
26862
27016
  case "quadrant-matrix":
26863
27017
  return /* @__PURE__ */ jsxRuntime.jsx(QuadrantNode, { node: resolvedNode, active, stateValues });
26864
27018
  case "tree-hierarchy":
26865
- return /* @__PURE__ */ jsxRuntime.jsx(TreeNode, { node: resolvedNode, active, stateValues });
27019
+ return /* @__PURE__ */ jsxRuntime.jsx(
27020
+ TreeNode,
27021
+ {
27022
+ node: resolvedNode,
27023
+ active,
27024
+ stateValues,
27025
+ drawing,
27026
+ progress
27027
+ }
27028
+ );
26866
27029
  case "journey-map":
26867
- return /* @__PURE__ */ jsxRuntime.jsx(UserJourneyNode, { node: resolvedNode, active, stateValues });
27030
+ return /* @__PURE__ */ jsxRuntime.jsx(
27031
+ UserJourneyNode,
27032
+ {
27033
+ node: resolvedNode,
27034
+ active,
27035
+ stateValues,
27036
+ drawing,
27037
+ progress
27038
+ }
27039
+ );
26868
27040
  case "shape-file":
26869
27041
  return /* @__PURE__ */ jsxRuntime.jsx(ShapeFileNode, { node: resolvedNode, active });
26870
27042
  case "shape-folder":