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