@cardenelabs/cdl 0.9.0 → 0.11.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.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CdlDiagram, S as Signal, a as CdlInput, b as CdlLane, c as CdlNode, T as Tone, d as Side, E as EdgeStyle, e as CdlState, f as CdlEventTarget, g as Computed, h as CdlDerivedValue, i as CdlScrollTrigger, L as LaidDiagram, j as CdlDiagramViewProps, k as LaidEdge, l as LaidNode, m as CdlEdge, B as BBox, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-hmFRAabt.cjs';
2
- export { n as CdlDiagramView, o as CdlEventBinding, p as CdlEventKind, q as CdlFormula, r as CdlPhase, I as InteractiveHandlerMap, s as InteractiveSignalsAccessor, t as LaidLane, u as NODE_KINDS, v as ScrollProgressHandle, w as TONES, x as computeEventBindingKey, y as computeFormulaKey, z as computeInputSignalKey, A as computeScrollTriggerKey, D as computed, F as createInteractiveSignalsAccessor, G as createScrollProgressHandle, H as createScrollProgressSignals, K as hasInteractivePrimitives, M as signal } from './render-hmFRAabt.cjs';
1
+ import { C as CdlDiagram, S as Signal, a as CdlInput, b as CdlLane, c as CdlNode, T as Tone, d as Side, E as EdgeStyle, e as CdlState, f as CdlEventTarget, g as Computed, h as CdlDerivedValue, i as CdlScrollTrigger, L as LaidDiagram, j as CdlDiagramViewProps, k as LaidEdge, l as LaidNode, m as CdlEdge, B as BBox, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-DwH8v5Mb.cjs';
2
+ export { n as CdlDiagramView, o as CdlEventBinding, p as CdlEventKind, q as CdlFormula, r as CdlPhase, I as InteractiveHandlerMap, s as InteractiveSignalsAccessor, t as LaidLane, u as NODE_KINDS, v as ScrollProgressHandle, w as TONES, x as computeEventBindingKey, y as computeFormulaKey, z as computeInputSignalKey, A as computeScrollTriggerKey, D as computed, F as createInteractiveSignalsAccessor, G as createScrollProgressHandle, H as createScrollProgressSignals, K as hasInteractivePrimitives, M as signal } from './render-DwH8v5Mb.cjs';
3
3
  import { JSX } from 'react';
4
4
 
5
5
  declare function effect(fn: () => void | (() => void)): () => void;
@@ -997,6 +997,11 @@ type InputChain = {
997
997
  };
998
998
  type PhaseBuilder = {
999
999
  activate: (...ids: string[]) => PhaseBuilder;
1000
+ /**
1001
+ * この phase で左の起点から描き始める node を指定する (cdl#512)。
1002
+ * 対象は phase の進み (0→1) に合わせて描かれる。 現在の対象種別は `chart-line`。
1003
+ */
1004
+ draw: (...ids: string[]) => PhaseBuilder;
1000
1005
  /** 数値 state の線形補間 (write phase で 100→90 等) */
1001
1006
  tween: (stateId: string, from: number, to: number) => PhaseBuilder;
1002
1007
  /** 任意型 state を即時切替 (この phase 到達で value 上書き、 lerp なし) */
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CdlDiagram, S as Signal, a as CdlInput, b as CdlLane, c as CdlNode, T as Tone, d as Side, E as EdgeStyle, e as CdlState, f as CdlEventTarget, g as Computed, h as CdlDerivedValue, i as CdlScrollTrigger, L as LaidDiagram, j as CdlDiagramViewProps, k as LaidEdge, l as LaidNode, m as CdlEdge, B as BBox, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-hmFRAabt.js';
2
- export { n as CdlDiagramView, o as CdlEventBinding, p as CdlEventKind, q as CdlFormula, r as CdlPhase, I as InteractiveHandlerMap, s as InteractiveSignalsAccessor, t as LaidLane, u as NODE_KINDS, v as ScrollProgressHandle, w as TONES, x as computeEventBindingKey, y as computeFormulaKey, z as computeInputSignalKey, A as computeScrollTriggerKey, D as computed, F as createInteractiveSignalsAccessor, G as createScrollProgressHandle, H as createScrollProgressSignals, K as hasInteractivePrimitives, M as signal } from './render-hmFRAabt.js';
1
+ import { C as CdlDiagram, S as Signal, a as CdlInput, b as CdlLane, c as CdlNode, T as Tone, d as Side, E as EdgeStyle, e as CdlState, f as CdlEventTarget, g as Computed, h as CdlDerivedValue, i as CdlScrollTrigger, L as LaidDiagram, j as CdlDiagramViewProps, k as LaidEdge, l as LaidNode, m as CdlEdge, B as BBox, N as NodeKind, J as JourneyEmotion, Q as QuadrantKey } from './render-DwH8v5Mb.js';
2
+ export { n as CdlDiagramView, o as CdlEventBinding, p as CdlEventKind, q as CdlFormula, r as CdlPhase, I as InteractiveHandlerMap, s as InteractiveSignalsAccessor, t as LaidLane, u as NODE_KINDS, v as ScrollProgressHandle, w as TONES, x as computeEventBindingKey, y as computeFormulaKey, z as computeInputSignalKey, A as computeScrollTriggerKey, D as computed, F as createInteractiveSignalsAccessor, G as createScrollProgressHandle, H as createScrollProgressSignals, K as hasInteractivePrimitives, M as signal } from './render-DwH8v5Mb.js';
3
3
  import { JSX } from 'react';
4
4
 
5
5
  declare function effect(fn: () => void | (() => void)): () => void;
@@ -997,6 +997,11 @@ type InputChain = {
997
997
  };
998
998
  type PhaseBuilder = {
999
999
  activate: (...ids: string[]) => PhaseBuilder;
1000
+ /**
1001
+ * この phase で左の起点から描き始める node を指定する (cdl#512)。
1002
+ * 対象は phase の進み (0→1) に合わせて描かれる。 現在の対象種別は `chart-line`。
1003
+ */
1004
+ draw: (...ids: string[]) => PhaseBuilder;
1000
1005
  /** 数値 state の線形補間 (write phase で 100→90 等) */
1001
1006
  tween: (stateId: string, from: number, to: number) => PhaseBuilder;
1002
1007
  /** 任意型 state を即時切替 (この phase 到達で value 上書き、 lerp なし) */
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { useMemo, useEffect, useState, useSyncExternalStore, useRef, useCallback, useLayoutEffect } from 'react';
1
+ import { useMemo, useEffect, useState, useSyncExternalStore, useRef, useCallback, useLayoutEffect, useId } from 'react';
2
2
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
3
 
4
4
  // src/reactive/internal.ts
@@ -9361,6 +9361,10 @@ function makePhaseBuilder(acc) {
9361
9361
  acc.activate.push(...ids);
9362
9362
  return api;
9363
9363
  },
9364
+ draw(...ids) {
9365
+ acc.draw.push(...ids);
9366
+ return api;
9367
+ },
9364
9368
  tween(stateId, from, to) {
9365
9369
  acc.tweens.push({ stateId, from, to });
9366
9370
  return api;
@@ -11440,7 +11444,7 @@ function diagram(id, options) {
11440
11444
  }
11441
11445
  },
11442
11446
  phase(phaseId, opts, build) {
11443
- const acc = { activate: [], tweens: [], sets: [] };
11447
+ const acc = { activate: [], draw: [], tweens: [], sets: [] };
11444
11448
  build(makePhaseBuilder(acc));
11445
11449
  phases.push({
11446
11450
  id: phaseId,
@@ -11448,6 +11452,8 @@ function diagram(id, options) {
11448
11452
  title: opts.title,
11449
11453
  body: opts.body,
11450
11454
  activate: acc.activate,
11455
+ // 空なら欄ごと置かない。 置くと `draw` を使わない図の JSON の形が変わる
11456
+ ...acc.draw.length > 0 ? { draw: acc.draw } : {},
11451
11457
  tweens: acc.tweens,
11452
11458
  sets: acc.sets,
11453
11459
  badge: acc.badge
@@ -15856,6 +15862,7 @@ function nodeTemplateTexts(node) {
15856
15862
 
15857
15863
  // src/validate.ts
15858
15864
  var TONES2 = new Set(TONES);
15865
+ var DRAW_KINDS = /* @__PURE__ */ new Set(["chart-line", "chart-bar", "chart-pie"]);
15859
15866
  var KINDS = new Set(NODE_KINDS);
15860
15867
  var ENG_BANNED = /\b(FUNCTION|STORAGE|EVENT LOG|BALANCES MAPPING|READ|WRITE|EMIT|CALL)\b/;
15861
15868
  function validate(diag) {
@@ -15919,7 +15926,7 @@ function validate(diag) {
15919
15926
  ...(diag.formulas ?? []).map((f) => f.id),
15920
15927
  ...(diag.scrollTriggers ?? []).map((t) => t.id)
15921
15928
  ]);
15922
- const suggest = (target, candidates) => {
15929
+ const suggest = (target, candidates, candidateKind = "lane") => {
15923
15930
  const list = [...candidates];
15924
15931
  if (list.length === 0) return "";
15925
15932
  let best = "";
@@ -15931,7 +15938,7 @@ function validate(diag) {
15931
15938
  best = c;
15932
15939
  }
15933
15940
  }
15934
- return bestD <= 2 ? ` (\u3082\u3057\u304B\u3057\u3066 "${best}"?)` : ` (\u5B9A\u7FA9\u6E08 lane: ${list.slice(0, 5).join(", ")}${list.length > 5 ? "..." : ""})`;
15941
+ return bestD <= 2 ? ` (\u3082\u3057\u304B\u3057\u3066 "${best}"?)` : ` (\u5B9A\u7FA9\u6E08 ${candidateKind}: ${list.slice(0, 5).join(", ")}${list.length > 5 ? "..." : ""})`;
15935
15942
  };
15936
15943
  for (const n of diag.nodes) {
15937
15944
  if (!laneIds.has(n.lane)) {
@@ -15944,13 +15951,13 @@ function validate(diag) {
15944
15951
  for (const e of diag.edges) {
15945
15952
  if (!nodeIds.has(e.from)) {
15946
15953
  errors.push(
15947
- `[cdl] unknown-ref: edge "${e.id}" \u306E from "${e.from}" \u304C node \u306B\u5B58\u5728\u3057\u307E\u305B\u3093${suggest(e.from, nodeIds)}
15954
+ `[cdl] unknown-ref: edge "${e.id}" \u306E from "${e.from}" \u304C node \u306B\u5B58\u5728\u3057\u307E\u305B\u3093${suggest(e.from, nodeIds, "node")}
15948
15955
  \u2192 \u4FEE\u6B63\u4F8B: .node("${e.from}", { lane: "...", stack: 0, kind: "actor", title: "..." }) \u3092 edge \u5BA3\u8A00\u524D\u306B\u8FFD\u52A0`
15949
15956
  );
15950
15957
  }
15951
15958
  if (!nodeIds.has(e.to)) {
15952
15959
  errors.push(
15953
- `[cdl] unknown-ref: edge "${e.id}" \u306E to "${e.to}" \u304C node \u306B\u5B58\u5728\u3057\u307E\u305B\u3093${suggest(e.to, nodeIds)}
15960
+ `[cdl] unknown-ref: edge "${e.id}" \u306E to "${e.to}" \u304C node \u306B\u5B58\u5728\u3057\u307E\u305B\u3093${suggest(e.to, nodeIds, "node")}
15954
15961
  \u2192 \u4FEE\u6B63\u4F8B: .node("${e.to}", { lane: "...", stack: 0, kind: "...", title: "..." }) \u3092 edge \u5BA3\u8A00\u524D\u306B\u8FFD\u52A0`
15955
15962
  );
15956
15963
  }
@@ -15967,6 +15974,18 @@ function validate(diag) {
15967
15974
  errors.push(`[cdl] unknown-ref: phase "${p.id}" \u306E activate "${id}" \u306F node \u3067\u3082 edge \u3067\u3082\u306A\u3044 (typo \u306E\u53EF\u80FD\u6027)`);
15968
15975
  }
15969
15976
  }
15977
+ for (const id of p.draw ?? []) {
15978
+ if (!nodeIds.has(id)) {
15979
+ errors.push(`[cdl] unknown-ref: phase "${p.id}" \u306E draw "${id}" \u306F node \u3067\u306F\u306A\u3044 (typo \u306E\u53EF\u80FD\u6027)${suggest(id, nodeIds, "node")}`);
15980
+ continue;
15981
+ }
15982
+ const kind = diag.nodes.find((n) => n.id === id)?.kind;
15983
+ if (!DRAW_KINDS.has(String(kind))) {
15984
+ warnings.push(
15985
+ `phase "${p.id}" \u306E draw "${id}" \u306F kind "${kind}" \u3067\u3001 \u8D77\u70B9\u304B\u3089\u63CF\u304F\u52D5\u304D\u3092\u6301\u305F\u306A\u3044 (\u5BFE\u8C61\u306F ${[...DRAW_KINDS].join(" / ")})`
15986
+ );
15987
+ }
15988
+ }
15970
15989
  for (const t of p.tweens) {
15971
15990
  if (!stateIds.has(t.stateId)) {
15972
15991
  errors.push(`[cdl] unknown-ref: phase "${p.id}" tween \u5BFE\u8C61 state "${t.stateId}" \u672A\u5B9A\u7FA9`);
@@ -21264,7 +21283,9 @@ function resolveMindData(data, values) {
21264
21283
  function ChartLineNode({
21265
21284
  node,
21266
21285
  active,
21267
- stateValues = {}
21286
+ stateValues = {},
21287
+ drawing = false,
21288
+ progress = 1
21268
21289
  }) {
21269
21290
  const x0 = node.cx - node.w / 2;
21270
21291
  const y0 = node.cy - node.h / 2;
@@ -21285,6 +21306,24 @@ function ChartLineNode({
21285
21306
  const xAt = (idx) => PAD_LEFT + (data.length <= 1 ? canvasW / 2 : canvasW * idx / (data.length - 1));
21286
21307
  const yAt = (v) => plotTop + plotH - (v - vMin) / vRange * plotH;
21287
21308
  const points = data.map((d, idx) => `${xAt(idx)},${yAt(d.value)}`).join(" ");
21309
+ const \u70B9\u307E\u3067\u306E\u9577\u3055 = [];
21310
+ let \u7DDA\u306E\u5168\u9577 = 0;
21311
+ let \u524D\u306E\u70B9;
21312
+ for (const [idx, datum] of data.entries()) {
21313
+ const \u4ECA\u306E\u70B9 = { x: xAt(idx), y: yAt(datum.value) };
21314
+ if (\u524D\u306E\u70B9) {
21315
+ \u7DDA\u306E\u5168\u9577 += Math.hypot(\u4ECA\u306E\u70B9.x - \u524D\u306E\u70B9.x, \u4ECA\u306E\u70B9.y - \u524D\u306E\u70B9.y);
21316
+ }
21317
+ \u70B9\u307E\u3067\u306E\u9577\u3055.push(\u7DDA\u306E\u5168\u9577);
21318
+ \u524D\u306E\u70B9 = \u4ECA\u306E\u70B9;
21319
+ }
21320
+ const \u4F38\u3073 = drawing ? Math.min(1, Math.max(0, Number.isFinite(progress) ? progress : 1)) : 1;
21321
+ const \u7DDA\u306E\u5148\u304C\u5C4A\u3044\u305F = (idx) => {
21322
+ if (!drawing) return true;
21323
+ if (data.length <= 1) return true;
21324
+ if (\u7DDA\u306E\u5168\u9577 === 0) return true;
21325
+ return \u4F38\u3073 >= (\u70B9\u307E\u3067\u306E\u9577\u3055[idx] ?? 0) / \u7DDA\u306E\u5168\u9577;
21326
+ };
21288
21327
  const gridCount = 4;
21289
21328
  const gridTicks = Array.from({ length: gridCount + 1 }, (_, i) => {
21290
21329
  const v = vMin + vRange * i / gridCount;
@@ -21362,7 +21401,8 @@ function ChartLineNode({
21362
21401
  stroke: "var(--cdl-tone-accent, #2d6a8f)",
21363
21402
  strokeWidth: 2.5,
21364
21403
  strokeLinejoin: "round",
21365
- strokeLinecap: "round"
21404
+ strokeLinecap: "round",
21405
+ ...drawing ? { pathLength: 1, strokeDasharray: 1, strokeDashoffset: 1 - \u4F38\u3073 } : {}
21366
21406
  }
21367
21407
  ),
21368
21408
  data.map((d, idx) => {
@@ -21373,40 +21413,43 @@ function ChartLineNode({
21373
21413
  const isValley = (prev === void 0 || d.value <= prev) && (next === void 0 || d.value <= next);
21374
21414
  const labelAbove = !isValley;
21375
21415
  const labelY = labelAbove ? cy - 12 : cy + 18;
21416
+ const \u51FA\u3059 = \u7DDA\u306E\u5148\u304C\u5C4A\u3044\u305F(idx);
21376
21417
  return /* @__PURE__ */ jsxs("g", { "data-cdl-unresolved": d.unresolved ? "true" : void 0, children: [
21377
- /* @__PURE__ */ jsx(
21378
- "circle",
21379
- {
21380
- cx,
21381
- cy,
21382
- r: 5,
21383
- fill: "var(--cdl-node-fill, #ffffff)",
21384
- stroke: "var(--cdl-tone-accent, #2d6a8f)",
21385
- strokeWidth: 2.5
21386
- }
21387
- ),
21388
- /* @__PURE__ */ jsx(
21389
- "circle",
21390
- {
21391
- cx,
21392
- cy,
21393
- r: 2.5,
21394
- fill: "var(--cdl-tone-accent, #2d6a8f)"
21395
- }
21396
- ),
21397
- /* @__PURE__ */ jsx(
21398
- "text",
21399
- {
21400
- "data-cdl-role": "chart-line-value",
21401
- x: cx,
21402
- y: labelY,
21403
- fontSize: 11,
21404
- fontWeight: 600,
21405
- textAnchor: "middle",
21406
- fill: "var(--cdl-text, #1a1f2a)",
21407
- children: d.value.toLocaleString()
21408
- }
21409
- ),
21418
+ \u51FA\u3059 && /* @__PURE__ */ jsxs(Fragment, { children: [
21419
+ /* @__PURE__ */ jsx(
21420
+ "circle",
21421
+ {
21422
+ cx,
21423
+ cy,
21424
+ r: 5,
21425
+ fill: "var(--cdl-node-fill, #ffffff)",
21426
+ stroke: "var(--cdl-tone-accent, #2d6a8f)",
21427
+ strokeWidth: 2.5
21428
+ }
21429
+ ),
21430
+ /* @__PURE__ */ jsx(
21431
+ "circle",
21432
+ {
21433
+ cx,
21434
+ cy,
21435
+ r: 2.5,
21436
+ fill: "var(--cdl-tone-accent, #2d6a8f)"
21437
+ }
21438
+ ),
21439
+ /* @__PURE__ */ jsx(
21440
+ "text",
21441
+ {
21442
+ "data-cdl-role": "chart-line-value",
21443
+ x: cx,
21444
+ y: labelY,
21445
+ fontSize: 11,
21446
+ fontWeight: 600,
21447
+ textAnchor: "middle",
21448
+ fill: "var(--cdl-text, #1a1f2a)",
21449
+ children: d.value.toLocaleString()
21450
+ }
21451
+ )
21452
+ ] }),
21410
21453
  /* @__PURE__ */ jsx(
21411
21454
  "text",
21412
21455
  {
@@ -21425,8 +21468,11 @@ function ChartLineNode({
21425
21468
  function ChartPieNode({
21426
21469
  node,
21427
21470
  active,
21428
- stateValues = {}
21471
+ stateValues = {},
21472
+ drawing = false,
21473
+ progress = 1
21429
21474
  }) {
21475
+ const instanceId = useId().replace(/[^A-Za-z0-9_-]/g, "");
21430
21476
  const x0 = node.cx - node.w / 2;
21431
21477
  const y0 = node.cy - node.h / 2;
21432
21478
  const data = resolveChartData(node.chartData ?? [], stateValues);
@@ -21439,20 +21485,26 @@ function ChartPieNode({
21439
21485
  const cx = pieAreaW / 2;
21440
21486
  const cy = PAD_TOP + chartAreaH / 2;
21441
21487
  let cumAngle = -Math.PI / 2;
21488
+ let cumFrac = 0;
21442
21489
  const slices = data.map((d) => {
21443
21490
  const frac = d.value / total;
21444
21491
  const angle = frac * Math.PI * 2;
21445
21492
  const a0 = cumAngle;
21446
21493
  const a1 = cumAngle + angle;
21447
21494
  cumAngle = a1;
21495
+ const startFrac = cumFrac;
21496
+ cumFrac += frac;
21448
21497
  const x1 = cx + radius * Math.cos(a0);
21449
21498
  const y1 = cy + radius * Math.sin(a0);
21450
21499
  const x2 = cx + radius * Math.cos(a1);
21451
21500
  const y2 = cy + radius * Math.sin(a1);
21452
21501
  const large = angle > Math.PI ? 1 : 0;
21453
21502
  const path = `M ${cx} ${cy} L ${x1} ${y1} A ${radius} ${radius} 0 ${large} 1 ${x2} ${y2} Z`;
21454
- return { d, frac, path };
21503
+ return { d, frac, path, startFrac };
21455
21504
  });
21505
+ const \u958B\u304D = drawing ? Math.min(1, Math.max(0, Number.isFinite(progress) ? progress : 1)) : 1;
21506
+ const \u5207\u308A\u629C\u304Did = `cdl-pie-draw-${instanceId}`;
21507
+ const \u958B\u304D\u59CB\u3081\u305F = (startFrac) => !drawing || \u958B\u304D > startFrac;
21456
21508
  const legendX = pieAreaW + 8;
21457
21509
  const legendGap = Math.min(28, chartAreaH / Math.max(data.length, 1));
21458
21510
  const legendStartY = PAD_TOP + (chartAreaH - legendGap * data.length) / 2 + legendGap / 2;
@@ -21471,7 +21523,8 @@ function ChartPieNode({
21471
21523
  strokeWidth: active ? 3 : 1.25
21472
21524
  }
21473
21525
  ),
21474
- slices.map((s, idx) => /* @__PURE__ */ jsx(
21526
+ drawing && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: \u5207\u308A\u629C\u304Did, children: \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(cx, cy, radius + 2, \u958B\u304D) }) }),
21527
+ /* @__PURE__ */ jsx("g", { ...drawing ? { clipPath: `url(#${\u5207\u308A\u629C\u304Did})` } : {}, children: slices.map((s, idx) => /* @__PURE__ */ jsx(
21475
21528
  "path",
21476
21529
  {
21477
21530
  "data-cdl-role": "chart-pie-slice",
@@ -21483,8 +21536,8 @@ function ChartPieNode({
21483
21536
  strokeWidth: 1.5
21484
21537
  },
21485
21538
  `slice-${idx}`
21486
- )),
21487
- slices.map((s, idx) => /* @__PURE__ */ jsxs("g", { transform: `translate(${legendX} ${legendStartY + idx * legendGap})`, children: [
21539
+ )) }),
21540
+ slices.map((s, idx) => !\u958B\u304D\u59CB\u3081\u305F(s.startFrac) ? null : /* @__PURE__ */ jsxs("g", { transform: `translate(${legendX} ${legendStartY + idx * legendGap})`, children: [
21488
21541
  /* @__PURE__ */ jsx(
21489
21542
  "rect",
21490
21543
  {
@@ -21522,6 +21575,15 @@ function ChartPieNode({
21522
21575
  ] }, `legend-${idx}`))
21523
21576
  ] });
21524
21577
  }
21578
+ function \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(cx, cy, r, \u958B\u304D) {
21579
+ if (\u958B\u304D <= 0) return null;
21580
+ if (\u958B\u304D >= 1) return /* @__PURE__ */ jsx("circle", { cx, cy, r });
21581
+ const a0 = -Math.PI / 2;
21582
+ const a1 = a0 + \u958B\u304D * Math.PI * 2;
21583
+ const large = \u958B\u304D > 0.5 ? 1 : 0;
21584
+ const d = `M ${cx} ${cy} L ${cx + r * Math.cos(a0)} ${cy + r * Math.sin(a0)} A ${r} ${r} 0 ${large} 1 ${cx + r * Math.cos(a1)} ${cy + r * Math.sin(a1)} Z`;
21585
+ return /* @__PURE__ */ jsx("path", { d });
21586
+ }
21525
21587
  var FALLBACK_ORDER = ["accent", "teal", "warning", "success", "info", "error"];
21526
21588
  function sliceColor(tone, idx) {
21527
21589
  if (tone) return TONE[tone];
@@ -21530,7 +21592,9 @@ function sliceColor(tone, idx) {
21530
21592
  function ChartBarNode({
21531
21593
  node,
21532
21594
  active,
21533
- stateValues = {}
21595
+ stateValues = {},
21596
+ drawing = false,
21597
+ progress = 1
21534
21598
  }) {
21535
21599
  const x0 = node.cx - node.w / 2;
21536
21600
  const y0 = node.cy - node.h / 2;
@@ -21553,6 +21617,8 @@ function ChartBarNode({
21553
21617
  const v = vMax * i / gridCount;
21554
21618
  return { y: yAt(v), value: v };
21555
21619
  });
21620
+ const \u4F38\u3073 = drawing ? Math.min(1, Math.max(0, Number.isFinite(progress) ? progress : 1)) : 1;
21621
+ const \u6A2A\u8EF8\u306Ey = PAD_TOP + canvasH;
21556
21622
  return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
21557
21623
  /* @__PURE__ */ jsx(
21558
21624
  "rect",
@@ -21609,26 +21675,28 @@ function ChartBarNode({
21609
21675
  const bx = xAt(idx);
21610
21676
  const by = yAt(d.value);
21611
21677
  const bh = PAD_TOP + canvasH - by;
21678
+ const \u898B\u3048\u3066\u3044\u308B\u982D = \u6A2A\u8EF8\u306Ey - (\u6A2A\u8EF8\u306Ey - by) * \u4F38\u3073;
21679
+ const \u68D2 = /* @__PURE__ */ jsx(
21680
+ "rect",
21681
+ {
21682
+ "data-cdl-role": "chart-bar",
21683
+ "data-cdl-unresolved": d.unresolved ? "true" : void 0,
21684
+ x: bx,
21685
+ y: by,
21686
+ width: barW,
21687
+ height: bh,
21688
+ rx: 2,
21689
+ fill: "var(--cdl-tone-accent, #2d6a8f)",
21690
+ fillOpacity: 0.9
21691
+ }
21692
+ );
21612
21693
  return /* @__PURE__ */ jsxs("g", { children: [
21613
- /* @__PURE__ */ jsx(
21614
- "rect",
21615
- {
21616
- "data-cdl-role": "chart-bar",
21617
- "data-cdl-unresolved": d.unresolved ? "true" : void 0,
21618
- x: bx,
21619
- y: by,
21620
- width: barW,
21621
- height: bh,
21622
- rx: 2,
21623
- fill: "var(--cdl-tone-accent, #2d6a8f)",
21624
- fillOpacity: 0.9
21625
- }
21626
- ),
21694
+ drawing ? /* @__PURE__ */ jsx("g", { transform: `translate(0 ${\u6A2A\u8EF8\u306Ey}) scale(1 ${\u4F38\u3073}) translate(0 ${-\u6A2A\u8EF8\u306Ey})`, children: \u68D2 }) : \u68D2,
21627
21695
  /* @__PURE__ */ jsx(
21628
21696
  "text",
21629
21697
  {
21630
21698
  x: bx + barW / 2,
21631
- y: by - 6,
21699
+ y: \u898B\u3048\u3066\u3044\u308B\u982D - 6,
21632
21700
  fontSize: 11,
21633
21701
  textAnchor: "middle",
21634
21702
  fill: "var(--cdl-text, #1a1f2a)",
@@ -26701,6 +26769,7 @@ function ShapeCustomerServiceNode({ node, active }) {
26701
26769
  function CdlNodeView({
26702
26770
  node,
26703
26771
  active,
26772
+ drawing = false,
26704
26773
  progress,
26705
26774
  stateValues,
26706
26775
  currentPhaseId
@@ -26750,11 +26819,38 @@ function CdlNodeView({
26750
26819
  // 数と語を取る 7 種に対し、mind-map / tree-hierarchy は **名前だけ** を取る (#467)。
26751
26820
  // 親子の繋がりと、描かれない欄 (補足) は解決しない。
26752
26821
  case "chart-line":
26753
- return /* @__PURE__ */ jsx(ChartLineNode, { node: resolvedNode, active, stateValues });
26822
+ return /* @__PURE__ */ jsx(
26823
+ ChartLineNode,
26824
+ {
26825
+ node: resolvedNode,
26826
+ active,
26827
+ stateValues,
26828
+ drawing,
26829
+ progress
26830
+ }
26831
+ );
26754
26832
  case "chart-pie":
26755
- return /* @__PURE__ */ jsx(ChartPieNode, { node: resolvedNode, active, stateValues });
26833
+ return /* @__PURE__ */ jsx(
26834
+ ChartPieNode,
26835
+ {
26836
+ node: resolvedNode,
26837
+ active,
26838
+ stateValues,
26839
+ drawing,
26840
+ progress
26841
+ }
26842
+ );
26756
26843
  case "chart-bar":
26757
- return /* @__PURE__ */ jsx(ChartBarNode, { node: resolvedNode, active, stateValues });
26844
+ return /* @__PURE__ */ jsx(
26845
+ ChartBarNode,
26846
+ {
26847
+ node: resolvedNode,
26848
+ active,
26849
+ stateValues,
26850
+ drawing,
26851
+ progress
26852
+ }
26853
+ );
26758
26854
  case "gantt-timeline":
26759
26855
  return /* @__PURE__ */ jsx(GanttNode, { node: resolvedNode, active, stateValues });
26760
26856
  case "mind-map":
@@ -26944,6 +27040,7 @@ function CdlStage({
26944
27040
  svgRef
26945
27041
  }) {
26946
27042
  const activeSet = new Set(currentPhase?.activate ?? []);
27043
+ const drawSet = new Set(currentPhase?.draw ?? []);
26947
27044
  const { lifelineStarts, uniformFooterTop } = useMemo(() => {
26948
27045
  const starts = lifelineStartYs(laid.nodes);
26949
27046
  return {
@@ -27080,6 +27177,7 @@ function CdlStage({
27080
27177
  {
27081
27178
  node,
27082
27179
  active: activeSet.has(node.id),
27180
+ drawing: drawSet.has(node.id),
27083
27181
  progress,
27084
27182
  stateValues,
27085
27183
  currentPhaseId: currentPhase?.id